While importing a python script from another script I want the script code that is classically protected by
if __name__ == "__main__":
....
....
to be run, how can I get that code run?
What I am trying to do is from a python script, dynamically change a module then import an existing script which should see the changes made and run its __main__
code like it was directly invoked by python?
I need to execute the 2nd python script in the same namespace as the 1st python script and pass the 2nd script command line parameters. execfile() suggested below might work but that doesn't take any command line parameters.
I would rather not edit the 2nd script (external code) as I want the 1st script to be a wrapper around it.