I'm trying to create an instance of a Thread
type class called A
within the class B
that's in the same file.
I tried some combinations x = A(i)
, x = A.A(i)
, x = A.__init(i)
and so on...
from threading import Thread
class A(Thread):
def __init__(self, i)
Thread.__init__(self)
self.i = i
def run(self):
print('foo')
class B()
def __init__(self):
x = #instance of A ?
x.start()
if __name__ == '__main__':
B() # Here I call the class B that should start the thread of A
I need to call the class. And not a method inside the class. Because I want then to call the x.start()
method to start the thread.