How Will You Share Global Variables Across Modules?
Answer:
If you add a variable to the <__builtin__> module, it will be accessible as if a global from any other module that includes <__builtin__> — which is all of them, by default.
a.py contains
print foo
b.py contains
import __builtin__
__builtin__.foo = 1
import a
The result is that "1" is printed.
Note: Python 3 introduced the builtins keyword as a replacement for the <__builtin__>.