[IronPython] Sharing state between embedded PythonEngines
chris.stoy at redstorm.com
Wed Apr 11 21:14:51 CEST 2007
I'm working on embedding IronPython in a C# application and would like
to have a single, global module where I expose my objects and run
scripts, and have multiple views into that state.
For example, I want to have one (or more) IronPython console views that
provide an interactive prompt that the user can type in and execute
code. If I enter a function/variable in one of the consoles, then it is
also available in the others. (ie, I enter "x=1" in console A and in
console B I can say "print x" and see "1" output.) I also want to
execute much larger, non-interactive scripts that a user can write and,
again, this state is shared across all my IronPython views.
So, am I just thinking about this wrong? How are people embedding
IronPython in their apps? It seems strange (and inefficient) to have to
create a new PythonEngine and add all the references and expose globals
every time I want to execute script. Is there a way to share some of
this state? Can this be done using EngineModules?
Any thoughts would be appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users