-2

How can I execute three or more Python scripts in parallel?

Currently I am executing three Python scripts in three different consoles of Spyder.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • 1
    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

One solution could be to import all the scripts and then simultaneously execute them in a function.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • 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