1

I want to run two Python scripts in parallel on a raspberry pi B+, but I don't know how to I do that. Could you please tell me how to do it?

Thanks a bunch!!!

2 Answers 2

1

I've not used a raspberry pi but I'm assuming it is using Bash or something similar and you can start 2 scripts simultaneously on that by running...

./script1.py & ./script2.py &

The ampersand sends the script to the background to be ran but the output still gets printed to stdout.

The scripts will start by printing out something like...

[1] 9141
[2] 9142

The right number is the PID (Process ID) and that can be used to stop the script by running...

kill 9141
Sign up to request clarification or add additional context in comments.

Comments

0

On the RPi, I run concurrent programs (or scripts) using separate terminal windows. The following script (4fpu.sh) runs four copies of one program and one other. This is useful if you want to monitor progression and avoid confusion on displayed output.

lxterminal -e ./RPiTemperature Pases 25,  Seconds 30
lxterminal -e ./burninfpu KWords 1, Section 3, Minutes 10, log 1
lxterminal -e ./burninfpu KWords 1, Section 3, Minutes 10, log 2
lxterminal -e ./burninfpu KWords 1, Section 3, Minutes 10, log 3
lxterminal -e ./burninfpu KWords 1, Section 3, Minutes 10, log 4

Comments

Your Answer

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.