Built-in Function: execfile
execfile('helloworld.py')
Usually it cannot be called with arguments. But here is a workaround:
import sys sys.argv = ['helloworld.py', 'arg']
Deprecated since 2.6: popen
import os os.popen('python helloworld.py')
With arguments:
os.popen('python helloworld.py arg').read()
Using Advance: subprocess
import subprocess subprocess.call(['python', 'helloworld.py'])
With arguments:
subprocess.call(['python', 'helloworld.py', 'arg'])
Read more in the documents :-)
Tested with this base helloworld.py :
import sys if len(sys.argv) > 1: print(sys.argv[1])
Hugues Fontenelle Feb 08 '14 at 19:21 2014-02-08 19:21
source share