Hello, How would I run monsterjoy.sh from another python script Thanks!
piborg
Tue, 05/26/2020 - 22:54
Permalink
It is fairly easy to run any terminal command from with a python script.
First make sure you have the os module imported:
os
import os
Now you can use os.command with a string like so:
os.command
os.system('/home/pi/monsterborg/runMonsterJoy.sh')
This will run the script and wait for it to finish.
You can add & at the end to run the script and carry on without waiting:
&
os.system('/home/pi/monsterborg/runMonsterJoy.sh &')
user1234
Wed, 05/27/2020 - 11:26
Many Thanks!
piborg
Tue, 05/26/2020 - 22:54
Permalink
Running other scripts from Python
It is fairly easy to run any terminal command from with a python script.
First make sure you have the
os
module imported:Now you can use
os.command
with a string like so:This will run the script and wait for it to finish.
You can add
&
at the end to run the script and carry on without waiting:user1234
Wed, 05/27/2020 - 11:26
Permalink
Thanks!
Many Thanks!