title: Multiprocessing inside another function
body: <p>I have such looped functions in this form:</p>
  
  <pre><code>from multiprocessing import Pool
  
  def foo_1(i):
      count = 1
      for something:
          # blah blah blah
          h=0
          while len()&lt;count:
            def foo_2(j):
                # blah blah blah
                return i + j
            h = h+1
          count +=1
  
  if __name__ == '__main__':
  
      pool = Pool(4)
      pool.imap_unordered(foo_2, range()):
  
      pool.close()
      pool.join()
  </code></pre>
  
  <p>How should the syntax look like to make it work? Because giving <code>if __name__ == '__main __'</code> inside <code>foo_1</code> does not work, and if I put it at the end, it does not recognize the function<code>foo_2</code>. Or maybe you need to completely rebuild the code syntax?      </p>