title: Multiprocessing return objects created by process
body: <p>I am using multiprocessing lib for accelerating process of class creation. Minimal example of my code:</p>
  <pre><code>from matplotlib.backends.backend_qt5agg import FigureCanvas
  class Custom_Class(FigureCanvas)
      .
      .
      .
  
  def generate_class_func(list_of_dfs, arg1, arg2):
      list_of_custom_classes = list()
      for df in list_of_dfs:
          custom_class = Custom_Class(df, arg1, arg2)
          list_of_custom_classes.append(custom_class)
      return list_of_custom_classes
  
  def main():
      import multiprocessing as mp
      with mp.Pool() as p:
          list_of_classes_list = p.starmap(generate_class_func, zip(list_of_dfs, repeat(arg1), repeat(arg2)))
          p.close()
          p.join()
      
  
  if __name__ == '__main__':
      main()
  </code></pre>
  <p>However, I got <code>multiprocess.pool.MaybeEncodingError: Error sending result: ... Reason: 'TypeError(&quot;cannot pickle 'Custom_Class' object&quot;)'</code> error. I also tried pathos.ProcessingPool module but the error is same. How can I return custom objects with multiprocessing?</p>