How to Make a Safe Shutdown Button for Raspberry Pi

@Clinton didn’t put a space (required) before the “&” so the process wouldn’t have gone into the background. Not that it matters as os.system waits for the process to finish.

Instead of os.system, use subprocess

import subprocess

subprocess.Popen("nohup python3 /home/pi/picam.py >&/dev/null &", shell=True)

This doesn’t wait for subprocess to finish before continuing.

“nohup” prevents the subprocess dying when the parent process ends, or the controlling terminal closes.

The >&/dev/null redirects stdout and stderr to the bin basically. If you want to capture the output, substitute the name of your log file.

The final & puts the subprocess into background.