The script you are trying to run is not executed because the working directory is the root directory ('/')
and that's because of this piece of code:
# decouple from parent environment
os.chdir("/")
So actually your code tries to execute: python /test.py
(which does not exist) and not 'your_current_directory/test.py'
.
To fix it either remove os.chdir("/")
, or provide the full path to the file like so:
subprocess.call(['python','my_full_path_to_working_directory/test.py'])