let\'s say i have the following files:
a.py
glo_var = 0
def func():
global glo_var
glo_var = 5
print \"A %d\" % (glo_var)
Using from ... import ...
copies the references from the other module. Rebinding the value in the original causes it to have a new reference, breaking the link between a.glo_var
and b.glo_var
permanently. Either use a mutable object and mutate it, or reimport a.glo_var
whenever you need the updated value.