title: where to store a log file name in python?
body: <p>I have a Python program that consists of several modules. The "main" module creates a file variable <code>log_file</code> for logging the output; all the other modules would need to write to that file as well.</p>
  
  <p>However, I don't want to import the "main" module into other modules, since it would be a really weird dependency (not to mention it might not even work due to circular dependency).</p>
  
  <p>Where, then, should I store the <code>log_file</code> variable?</p>
  
  <p>EDIT:</p>
  
  <p>Following @pyfunc answer - would this be ok:</p>
  
  <pre><code>--- config.py ---
  # does not mention log_file
  # unless it's required for syntax reasons; in which case log_file = None
  # ...
  
  --- main.py ---
  from datetime import datetime
  import config.py
  log_filename = str(datetime.now()) + '.txt'
  config.log_file = open(log_filename, 'w')
  # ...
  
  --- another_module.py ---
  import config.py
  # ...
  config.log_file.write(some_stuff)
  </code></pre>