I need to execute a python script from within another python-script multiple times with different arguments. I know this sounds horrible but there are reasons for it. Problem is however that the callee-script does not check if it is imported or executed (if __name__ == '__main__': ...).
- I know I could use subprocess.popen("python.exe callee.py -arg") but that seems to be much slower then it should be, and I guess thats because Python.exe is beeing started and terminated multiple times.
- I can't import the script as a module regularily because of its design as described in the beginning - upon import it will be executed without args because its missing a main() method.
- I can't change the callee script either
- As I understand it I can't use execfile() either because it doesnt take arguments