I'm trying to use a global variable, and somehow I'm ending up with two versions of that variable. Can anyone see how this could happen?
My simplified scenario looks like this
a/
init.py
b/
init.py
file1.py
file2.py
My first init.py has
from b.file1 import *
from b.file2 import *
In file1.py
I have __all__=[stuff, global_variable]
and following
global_variable = None
def doit():
global global_variable
global_variable = 1
print("set global variable to %s" %(global_variable))
So finally when I do this:
import a
a.doit()
print(a.global_variable)
I see
set global variable to 1
None