I have two python files located in different directories.
folder1
|--> routing.py
folder2
|--> script.py
I want to execute script.py
from routing.py
. script.py
takes multiple parameters to run. Currently, I am using subprocess
module python.
routing.py
import os
import subprocess
import sys
def test():
dirpath = os.getcwd()
os.chdir(folder2_path)
output = subprocess.check_output([sys.executable, "script.py", param1, param2, param3 ])
but, I am getting
raise CalledProcessError(retcode, cmd, output=output)
Is there any better way to do this? Do I miss something?