Calling scripts from within scripts, is this possible?
gerryandsharon at sympatico.ca
Sun Jun 15 18:47:33 CEST 2003
I am planning on building an App. that will create an environment in Python
that allows scripts to be called from that environment. This would require
one script to call another where the called script implicitly has access to
the environment and name space of the caller and it all happens in single
instance of the interpreter.
1) The master App. declares variables, imports other modules and
creates objects. It contains a list of the pathnames of other Slave script
files it can call or they can be entered through a UI.
2) When invoked, the master App. somehow loads and executes another
script file that can access the Master Apps variables, Objects and make use
of the modules imported by the Master App. The slave script sees these as
though they were system or global services. The slave script is simple and
may or may not import other modules for its own use and may or may not
define its own classes, variables, etc. Usually this slave script will just
be a set of procedural commands that make calls to resources defined and
controlled by the master App.
3) When execution reaches the end of the Slave script file the Master
regains control and another slave script could be called.
To reiterate, my question revolves around how to do steps 2) and 3)
More information about the Python-list