title: Concurrent methods inside another function in python
body: <p>I am new with multiprocessing in python and so far all the example I've seen are this kind (with one or more methods in the file and then '<em>main</em>'):</p>
  
  <pre><code>from multiprocessing import Process
  def f1(a):
      #do something
  
  def f2(b):
      #do something
  
  if __name__ == '__main__':
      f1(a1)
      p = Process(target=f2, args=(b2,))
      p.start()
      p.join()
  </code></pre>
  
  <p>If  I have instead a method who calls 2 functions in another file to be concurrent like in the following lines, </p>
  
  <pre><code>def function():
      #do something
      file2.f1(a) #first concurrent method
      file2.f2(b) #second concurrent method
  </code></pre>
  
  <p>how should I do?
  Can anyone make a simple example? I tried in this way, but it starts all the program again after the first loop :</p>
  
  <pre><code> def function():
      #do something
      for i in range(3):
         p1 = Process(target=file2.f1, args=(a)) #first concurrent method
         p2 = Process(target=file2.f2, args=(b)) #second concurrent method
         p1.start()
         p2.start()
         p1.join()
         p2.join()   
  </code></pre>