0

I'm trying to run multiple scripts to maintain the running speed.

I'm using two scripts that need each other to work, so I want another Python script like setup.py to run them:

import os
os.system('python script1.py && python script2.py')

But that doesn't work at the same time.

the Tin Man
161k44 gold badges222 silver badges308 bronze badges
asked Apr 15, 2020 at 13:18
2
  • Does this answer your question? Python: execute cat subprocess in parallel Commented Apr 15, 2020 at 13:21
  • Your use case isn't very well defined. If script2.py depends on script1.py, the you cannot run them in parallel. (Or, at least not completely.) Is this the case or do you want to run both scripts together multiple times in parallel? Commented Apr 19, 2020 at 4:57

1 Answer 1

1

maybe you can use multithreading : Python - Multithreading

You will be able to run different python scripts in different threads.

That will allow you to execute them in the same time.

If your script doesnt require a lot of layers of data to process, then you can keep using your processor.

Otherwise you can use your GPU. For example cuda for NVIDIA GPU : See cuda here

answered Apr 15, 2020 at 13:33
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.