I am making a new script(p.py)for my Raspberry Pi and i am trying to combine 2 python scripts named Final.py and A.py . I want to execute the Final.py for about 5 seconds and then kill it and proceet to A.py, run it for 25 seconds and kill it and repeat the whole process endlessly. However, both of the scripts are looped and i don't know how to end these processes. Here the p.py code:
import subprocess
import time
execfile('Finaaal.py') #looped script 1
time.sleep(5.0)
subprocess.call(['./1.sh']) #this kills Finaaal.py
execfile('A.py') #looped script 2
time.sleep(25.0)
subprocess.call(['./2.sh']) #this kills A.
Does anyone know any better ideas or a better way to fix this? Everything would be greatly appreciated!