How do I run a python script from within the IDLE interactive shell?
The following throws an error:
>>> python helloworld.py
SyntaxError: i
For example:
import subprocess
subprocess.call("C:\helloworld.py")
subprocess.call(["python", "-h"])
you can do it by two ways
import file_name
exec(open('file_name').read())
but make sure that file should be stored where your program is running
There is one more alternative (for windows) -
import os
os.system('py "<path of program with extension>"')