我这里有一个函数可以在另一个进程中运行外部 python 脚本。m 是多处理模块
def run(app,WindowOffX,WindowOffY,WindowWidth,WindowHeight):
try:
exec("import Programs."+app+".main as Foo")
Foo.init()
p = m.Process(target=Foo.main(WindowOffX,WindowOffY,WindowWidth,WindowHeight))
except ImportError:
print("That app doesn't exist!!! O.O")
但这会产生NameError: global name 'Foo' is not defined
. 有人可以帮忙吗?