I have a python file in different directory and I don't want to change the directory of the file so how can I execute another python file from my first python file
Asked
Active
Viewed 78 times
-1
-
Might want to check this: [How to import a module given the full path](https://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path) – Code Ninja 2C4U Aug 16 '20 at 11:43
1 Answers
1
You can spawn a new process using os.system command and use it like that.
import os
os.system('python absolute/path/to/file.py')

Simon Fredrich
- 95
- 1
- 10