When importing a python script from another script, I need script code that is classically protected
if __name__ == "__main__":
....
....
how can i run this code?
I am trying to do this with a python script, dynamically change a module, and then import an existing script that should see the changes made and run my code __main__, how was this called directly by python?
I need to execute the second python script in the same namespace as the first python script and pass the command line parameters of the 2nd script. execfile () suggested below may work, but does not accept any command line options.
I would prefer not to edit the second script (external code) as I want the first script to be a wrapper around it.
source
share