HTuse
Python ·
8 steps
How to Call a Script in Python?
Use `import script_name`
Use `from script_name import function_name`
Call a function with `function_name()`
Run a script from another script with `subprocess.run(["python", "script_name.py"])`
Execute a script file with `exec(open("script_name.py").read())`
Use `runpy.run_path("script_name.py")`
Call a script as a module with `python -m module_name`
Use `os.system("python script_name.py")`