how to have global variables among different modules in Python
Question: I investigated that scope of global variables in python is limited to the
module. But I need the scope to be global among different modules. Is there
such a thing? I played around `__builtin__` but no luck.

thanks in advance!


Answer: You can access global variables from other modules by importing them
explicitly.

In module `foo`:

    
    
      joe = 5
    

In module `bar`:

    
    
      from foo import joe
      print joe
    

Note that this isn't recommended, though. It's much better to hide access to a
module's variables by using functions.

