【发布时间】:2013-10-26 16:01:19
【问题描述】:
当我的主脚本正在运行时
class Blah():
update=0
def testthings(function):
return function(9)
main = Blah()
while True:
main.update+=1
如何在主脚本运行时运行独立脚本以访问“主变量”(在我的主脚本中定义)?
这样的东西会很有用
main = GetMain()
while True:
main.testthings(lambda x: x)
【问题讨论】:
-
你的意思是:
python main.py & python otherscript.py? -
他可能想要线程。
-
哇,不,我在启动时运行 main.py。然后 otherscript.py 在其他时间(只要用户想要)
-
@KingofGames 所以你想访问其他 python 进程的变量?
-
我想访问另一个进程的对象
标签: python interprocess inter-process-communicat