title: Python: How to run multiple files at the same time?
body: <p>I'm trying to create a For-loop which automatically starts different python files at the exact same time, but they always seem to run one after one.</p>
  
  <pre><code>import os
  import multiprocessing
  import p1, p2, p3
  
  #first idea
  
  path = "C:" + "\\Users\\Max\\\\Desktop\\\python\\tasks\\"
  tasks = ['p1.py', 'p2.py', 'p3.py']
  len = tasks.__len__()
  ind = 0
  for i in range(len):
      os.system('python' + ' ' + tasks[ind])
      ind += 1
  
  #second idea
  
  for x in ('p1', 'p2', 'p3'):
      p = multiprocessing.Process(target=lambda: __import__(x))
      p.start()
  </code></pre>
  
  <p>p1, p2, p3 are the files I'm trying to run at the same time, but they get executed one after one, so if the code is:</p>
  
  <pre><code>time.sleep(10)
  print("hello)
  </code></pre>
  
  <p>I will have to wait 30 seconds for the program to be done, instead of the 10 seconds I want.</p>