title: how to use multiprocessing inside class have to attribute are object and dict?
body: <p>I have a class:</p>
  <pre><code># myclass.py
  class MyClass(object):
      def __init__(self,*args):
          self.env = args[0] 
          self.mydict = args[1]
  
      def run(self):
          list_data = [1,2,3,4,5,6,7,8,9,10]
          pool = mp.Pool(3)
          for _ in tqdm(pool.imap_unordered(self.exefunction, list_data), total = len(a), desc = 'Main process'):
              pass
          pool.close()
          pool.join
  
      def exefunction(self,number):
          print(number)
          print(self.env)
          print(self.mydict)
  
  # myenv.py
  class MyEnv(object):
      def __init__(self, *args, **kwargs):
          self.database = args[0]
          self.host = args[1]
          self.port = args[2]
          self.user = args[3]
          self.pwd = args[4]
          self.sp = None
          self.param = None
          self.output_exception_msg = None
          self.output_sperror_msg = None
          self.pool = self.create_pool()
  
      def create_pool(self):
      self.pool = MySQLConnectionPool(pool_name=config.pool_name, pool_size=config.pool_size,
                                 user=self.user, password=self.pwd, host=self.host, port=self.port, database=self.database)
      return self.pool
  
  # main.py
  if __name__ == '__main__':
      list_dict = [{ 1 : 3 , 5 : 10 }]
      env = MyEnv(**dbconfig)
      build_class = MyClass(env, list_dict)
      build_class.run()
  </code></pre>
  <p><code>self.env</code> is an object that was created from another class.</p>
  <p>When I call to function <code>run</code> I have a TypeError: <code>cannot serialize socket object</code>.</p>
  <p>I know the problem is <code>MyClass</code> has an object and dict (I try to pass <code>self.env</code> and <code>self.mydict</code> are integer and it's working). I don't have any solution to fix it.</p>
  <p><strong>UPDATE</strong>: I opened a connection pool into my DB ( <code>self.env</code> contains that)</p>