Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can try to use 'exec' statement in Python. This statement supports dynamic execution of Python code. The first expression should evaluate to either a string, an open file object, or a code object. If it is a string, the string is parsed as a suite of Python statements which is then executed (unless a syntax error occurs). [1] If it is an open file, the file is parsed until EOF and executed. If it is a code object, it is simply executed.

Example:

fid = open(r'C:\xxx\yyy.py'); exec(fid); fid.close();