In this simple example, the real answer in most cases is to use function arguments (as already mentioned). But if it made sense to check Python's review rules, I think I can clarify ...
C/++, , Python. #include. C/++ #include / ( ). , , , #included. #includes, .:-P
Python , . , . . , , . "" . . , a.py b "bar".
, . , b: a.bar = bar ( ).
a.py,
def foo():
print bar
b.py :
import a
a.bar = "baz"
a.foo()
a.py , b.py a.set_module_state( "baz" ).