title: Python Multiprocessing: How to make Pool and Manager work together?
body: <p>I am trying to understand how <code>Pool()</code> and <code>Manager()</code> can be combined in Python's multiprocessing library for having shared objects between the individual worker processes. In my example, I would like to have a shared list <code>input_list</code>, which should be accessable for all worker processes:</p>
  <pre><code>from multiprocessing import Pool, Manager
  
  def f(x):
      input_list.append(x)
      return x**2
  
  if __name__ == '__main__':
      manager = Manager()
      input_list = manager.list()
      with Pool(processes=3) as pool:
          results = pool.map(f, range(10))
      print(input_list)
  </code></pre>
  <p>However, I get a <code>NameError: name 'input_list' is not defined</code>. Any idea why <code>input_list</code> is not recognized as a shared object?</p>