title: Type Error: req_con() takes 1 positional argument but 12 were given
body: <p>Basically i am trying to return the ipaddress which i get in a function and pass that as an argument to the other function. Since its an ipaddress, It gives me an error as mentioned above. Is there any other way i could make it better?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>import zmq
  import time
  import socket
  import threading
  import multiprocessing
  from threading import Thread
  def bd_recv():
      login to get ip
  
  def req_con(host):
      context=zmq.Context()
      socket = context.socket(zmq.REQ)
      #address=host,port
  
      port=3233
      socket.connect("tcp://" "%s:%d" % ((host),port))
      print("sending request")
      socket.send_string("hey controller")
      msg=socket.recv(1024)
      print("received reply: %s" %msg)
  class ThreadWithReturnValue(Thread):
      def __init__(self, group=None, target=None, name=None,
                   args=(), kwargs={}, Verbose=None):
          Thread.__init__(self, group, target, name, args, kwargs)
          self._return = None
      def run(self):
          print(type(self._target))
          if self._target is not None:
              self._return = self._target(*self._args,
                                                  **self._kwargs)
      def join(self, *args):
          Thread.join(self, *args)
          return self._return
  if __name__=='__main__':
      #t1=threading.Thread(target=bd_recv,name='bdrecv')
      t3 = ThreadWithReturnValue(target=bd_recv)
      #t1.start()
      t3.start()
      host=(t3.join())  --&gt; The return ipaddress b is given as a host to other function 
      t2=threading.Thread(target=req_con,name='req',args=host,)  --&gt; here it gives me the error as 12 is given 
  
      t2.start()
  </code></pre>