[IronPython] Calling functions in IronPython that don't really exist
jslutter at reactorzero.com
Fri Dec 5 06:32:20 CET 2008
I have found another way that better suits what I'm trying to do (and
In a nutshell, I just add the function to the builtins. Here is the code:
// some member function, etc.
delegate int DoDelegate();
private int DoFunc()
//... in the IronPython initialization, after the scripting engine has
been created ...
ScriptScope builtins = Python.GetBuiltinModule(m_engine);
builtins.SetVariable("SomeTestFunction", new DoDelegate(DoFunc));
now, in the Python scripts I can call:
Simple problem and solution, but I just wanted a way to dynamically add
new functions to Python with names that I control.
More information about the Ironpython-users