Why am I getting AttributeError: Object has no attribute?

I have a class MyThread. In that, I have a method sample. I am trying to run it from within the same object context. Please have a look at the code: class myThread (threading.Thread): def __init__(self, threadID, name, counter, redisOpsObj): threading.Thread.__init__(self) self.threadID = threadID self.name = name self.counter = counter self.redisOpsObj = redisOpsObj def stop(self): … Read more

thread starts running before calling Thread.start

t1=threading.Thread(target=self.read()) print("something") t2=threading.Thread(target=self.runChecks(), args=(self,)) self.read runs indefinitely, so the program won’t ever reach the print line. How is this possible without calling t1.start()? (Even if I call that, it shold start running and go on to the next line, shouldn’t it?) Answers: Thank you for visiting the Q&A section on Magenaut. Please note that all … Read more