How can I call thread on a class method passing it 'self'? I have a class defined as follows and want to call class method in new thread with self as argument. I tried following but self is not passed as argument
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
thread.start_new_thread((lambda: Customer().process()), ())threadingmodule instead of obsoletethread.