如何在传递“自我”的类方法上调用线程?我有一个定义如下的类,并想在新线程中以 self 作为参数调用类方法。我尝试关注但 self 没有作为参数传递
cust_obj = Customer()
thread.start_new_thread(cust_obj.process, ())
class Customer():
def __init__(self):
pass
def process(self):
self.fetch_data()
self.serialize_data()
def fetch_data(self):
# Fetch data logic
pass
def serialize_data(self):
# Serialize fetched data
pass