我想知道是否可以以某种方式调用来自"外部"的线程中定义的方法。本身。这就是这个想法:
class ThreadWithCallableMethods(threading.Thread):
def callableMethodOne():
print "This is the first method"
def callableMethodTwo():
print "This is the second one"
theThread = ThreadWithCallableMethods()
theThread.start()
theThread.callableMethodOne()
theThread.callableMethodTwo()