title: Best way to share global variables between files in Python
body: <p>I was wondering what the best way is to use global variables in a multi-script python project.
  I've seen this question: <a href="https://stackoverflow.com/questions/13034496/using-global-variables-between-files-in-python">Using global variables between files?</a> - and while the accepted answer works, the solution seems clunky.</p>
  
  <p>See the below set of scripts. Only main.py is ever called directly; the rest are imported.</p>
  
  <p>First, I've declared my global variables in a separate file:</p>
  
  <pre><code>#global_vars.py
  my_string = "hello world"
  </code></pre>
  
  <p>The <code>main.py</code> prints the value of the string using a custom function, changes the value of the global variable, and then prints the new value</p>
  
  <pre><code>#main.py
  import global_vars
  import do_things_module
  
  #Print the instantiated value of the global string
  do_things_module.my_function()
  
  #Change the global variable globally
  global_vars.my_string = "goodbye"
  
  #Print the new value of the global string
  do_things_module.my_function()
  </code></pre>
  
  <p><code>do_things_module.py</code> contains our custom print function, and gets the string straight from the global</p>
  
  <pre><code>#do_things_module.py
  import global_vars
  
  def my_function():
      print(global_vars.my_string)
  </code></pre>
  
  <p>Having to keep referencing <code>global_vars.my_string</code> rather than just <code>my_string</code> to ensure I'm always reading/writing to the global scoped variable seems long-winded and not very 'pythonic'. Is there a better/neater way?</p>