Reputation: 1
So I have a raspberry pi pico, which on boot, runs main.py. I have a sister script on the Pico, and I was wondering if there was a function or way to run one of these sister scripts, by using code in main.py. I would also like it to only run the sister script, and not go back to main.py until the Pico reboots.
Something like this:
If variable1.value == 1: run sisterScript.py
I have tried putting the entire sister script into a function (imports and all) which I can then import and run from the main.py script. While it does call the sister script, it goes back to the main.py script. I would like it to stay on the sister script, after the main script had the command to switch.
Upvotes: 0
Views: 525
Reputation: 7308
To stay on side-loaded script- make it so it never finishes it's job. One of option- create endless loop
on sisterScript.py
# do stuff
while(True):
# do more stuff
# and do not leave this loop
on main.py
If variable1.value == 1:
import sisterScript
Upvotes: 0