I think you should try adding nohup to your script and use Popen ...
Something like that:
import os, subprocess subprocess.Popen(['nohup', 'script.py'], stdout=devnull, stderr=devnull)
If you put the function in script.py , it should work.
source share