title: How to pass "constant" arguments in a parallel mapping?
body: <p>I have been dealing the past few days with some problems where Variables that are defined within the main &quot;program&quot; are said to not be defined when I map a certain function.</p>
  <p>Anyways, I thought the solution was to pass these variables as Arguments but even then I try to do it with a MWE, I fail!</p>
  <p>It is probably something obvious so, sorry in advance for posting about this. Here it is:</p>
  <p>The function:</p>
  <pre><code>def arar(a1,*a3):
      a2=[]
      a2.append(a1+a3[0])
      return(a2)
  </code></pre>
  <p>The result for a <code>testloop=np.array([1,2,3,4])</code>:</p>
  <pre><code>testloop = np.array([1,2,3,4])
  args = 1
  a4=[]
  for i in testloop:
      a4.append(arar(i,args))
  print a4
  &gt;&gt;&gt;[[2], [3], [4], [5]]
  </code></pre>
  <p>and the &quot;parallel&quot; attempt:</p>
  <pre><code>testloop = np.array([1,2,3,4])
  import multiprocessing as mp
  pool      = mp.Pool(4)
  aaaa     = pool.map(arar,testloop)
  print(aaaa)
  &gt;&gt;&gt; [1, 2, 3, 4]
  </code></pre>
  <p>where the result is right, but I can't pass the <code>args</code> to the <code>map()</code> function so that I get <code>[2,3,4,5]</code>.</p>