title: Python multiprocessing: is it possible to have a pool inside of a pool?
body: <p>I have a module A that does a basic map/reduce by taking data and sending it to modules B, C, D etc for analysis and then joining their results together.</p>
  <p>But it appears that modules B, C, D etc cannot themselves create a multiprocessing pool, or else I get</p>
  <pre><code>AssertionError: daemonic processes are not allowed to have children
  </code></pre>
  <p>Is it possible to parallelize these jobs some other way?</p>
  <p>For clarity, here's an (admittedly bad) baby example. (I would normally try/catch but you get the gist).</p>
  <pre><code>A.py:
  
    import B
    from multiprocessing import Pool
  
    def main():
      p = Pool()
      results = p.map(B.foo,range(10))
      p.close()
      p.join()
      return results
  
  
  B.py:
    
    from multiprocessing import Pool
  
    def foo(x):
      p = Pool()
      results = p.map(str,x)
      p.close()
      p.join()
      return results
  </code></pre>