-2

How to execute 3 or more python code in parallel? currently i am executing three python codes 3 different consoles of spyder.

  • Please provide more details. Show code and explain in detail what you wish to achieve. – Bram Vanroy Oct 30 '19 at 10:26
  • Lets say i have three scripts a.py, b.py,c.py. Now how to execute these python scripts in parallel – Aravind Raj Reddy Oct 30 '19 at 10:37
  • The main question would be _why_. But running different terminals is the best way, indeed. (Or if you're on linux, this is easily done with running different `screen`s.) – Bram Vanroy Oct 30 '19 at 10:43
  • This answer to the question is "This is for automated algotrading" wherin my goal is to schedule each scripts to run at specific time every day – Aravind Raj Reddy Oct 30 '19 at 11:31

1 Answers1

0

The question is vague, but one solution could be to import all the scripts and then simultaneously execute them in a function.

  • I would still be sequential one after the other, if first script takes 30 minutes, then second script has to wait for 30 minutes, These scripts needs to be executed parallel – Aravind Raj Reddy Oct 30 '19 at 10:36
  • That is true unless you utilize the multiprocessing module please read this answer: https://stackoverflow.com/a/56138825/8405902 – Simbarashe Timothy Motsi Oct 30 '19 at 17:59