About this question
There is a class MyThread. I am trying to run the method sample from the same object context. Here’s the code:
Class mythread (threading,thread):
Def _init_9self, threadID, name, counter,
redis0psObj):
threading.Thread._init_(self)
self.threadID = ThreadID
Self.name = name
Self.counter = counter
self.redis0psObj = redis0psObj
Def stop (self):
Self.kill_received = True
Def sample (self):
Print “hello”
Def run (self):
Time.sleep (0.1)
Print “n Starting “ + self.name
self.sample()
On running, I am receiving the error
AttributeError : ‘my thread’ object has no attribute “sample”
What’s wrong?