方案一:循环导入/删除模块
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"