方案一:循环导入/删除模块

a.py

import sys, time

while True:
	from b import test
	test()
	del sys.modules(b)
	time.sleep(1)

b.py

def test():
	print "something"

方案二:reload模块

a.py

import time
import b

while True:
	b.test()
    reload(b)
	time.sleep(1)

b.py

def test():
	print "something"

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
  • 2021-10-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-22
  • 2022-12-23
  • 2021-07-22
  • 2022-01-02
  • 2022-12-23
  • 2023-03-20
相关资源
相似解决方案