Multiprocessing initially returns None
<p>I'm currently writing a program that utilizes the multiprocessing tool in Python.</p>

<p>When I try to return the result from the function that utilizes multiprocessing, and then print it, it will first attempt to print it and prints <code>None</code>.  However, once it runs through the multiprocessing function and process, it will print again with the valid answers.  This is odd, and I have figured out a way around it, but I'm curious as to if someone has a solid answer to why this happens.</p>

<p>Below is the function I use for multiprocessing.</p>

<pre><code>def ParallelProc:

    if __name__ == '__main__':

        core = 7

        p = mp.Pool(core)
        solutions = p.map(calc, NEW_IC)

        return solutions
</code></pre>

<p>Then I try to run it and set it to a variable, and print it like below</p>

<pre><code>sol = ParallelProc()
print sol
</code></pre>

<p>My only guess is that it runs the multiprocessing in the background and moves the code forward, trying to print with nothing returned yet.  Then once <code>ParallelProc</code> converges, it starts again from that point.</p>

<p>This is an easy work around seen below </p>

<pre><code>sol = ParallelProc()
if sol != None:
    print sol
</code></pre>

<p>Any ideas as to what is going on?</p>

<p>FYI I'm  running this code through the windows command prompt.</p>