title: Python - thread`s target is a method of an object
body: <p>I have the following code :</p>
  <p>Consumer.py</p>
  <pre><code>class Consumer():
  
      def __init__(self,q):
          print(&quot;Consumer&quot;)
          self.q = q
  
  
      def consumeItem(self,num):
          while  not self.q.empty():
              print(self.q.get())
  </code></pre>
  <p>Producer.py</p>
  <pre><code>class Producer():
      def __init__(self,q):
          self.q = q
          print(&quot;Producer&quot;)
  
      def generateItem(self):
          for i in range(1,100):
              print(&quot;produce item &quot;,i)
              self.q.put(i)
  </code></pre>
  <p>main :</p>
  <pre><code>import queue
  
  import threading
  q=queue.Queue()
  
  from Producer import Producer
  from Consumer import Consumer
  
  producer=Producer(q)
  consumer=Consumer(q)
  
  
  t1=threading.Thread(target=producer.generateItem(),name=&quot;thread1&quot;)
  t2=threading.Thread(target=consumer.consumeItem(),name=&quot;thread2&quot;,args=(1,))
  #t2=threading.Thread(target=consumer.consumeItem(),name=&quot;thread2&quot;,args=(consumer,1))
  #t2=threading.Thread(target=consumer.consumeItem(),name=&quot;thread2&quot;,kwargs={'self': consumer,'num': 2})
  
  t1.start()
  t2.start()
  </code></pre>
  <p>I keep getting the same error :</p>
  <pre><code>t2=threading.Thread(target=consumer.consumeItem(),name=&quot;thread2&quot;,args=(1))
  TypeError: consumeItem() missing 1 required positional argument: 'num'
  </code></pre>
  <p>As you can see in the code, I tried a few options to initialize the second thread. The first thread works like expected but the second one isn't working.</p>
  <p>Any idea why the first one works while the second isn't?</p>