I have two modules: a.py and b.py
a.py:
foo = 0
def increase():
global foo
foo += 1
b.py:
from a import *
increase()
print(foo)
Run the b.py will get the result: 0
, but my expect result is 1
Then I modified the b.py
b.py:
import a
a.increase()
print(a.foo)
Then I get the correct result: 1
My question is why the first edition of b.py getting a wrong result. What's the correct way to import a global variable?