I want to run a another sub-script from my current python parent-script which is located in a subfolder of the parent-script with subprocess.call('sub-script.py',cwd='subfolder')
and it can't find the path. Is there something I am missing on how to use cwd with subprocess
?
Folders:
parent-script.py
---subfolder
sub-script.py
since subfolder
is probably not in your path, you need to add "./" when calling sub-script.py (assuming it is executable):
subprocess.call('./sub-script.py', cwd='subfolder')