我的代码如下所示:
config.py
global var
var = None
file1.py
from config import *
def foo1():
global var
var = <object>
def foo2():
var.doWork1() # this works
file2.py
from config import *
def foo3():
var.doWork2() # this throws global name 'var' is not defined
为什么我无法在第二个模块中访问var?