I have found another way that better suits what I'm trying to do (and
control).

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()
{
  return 10;
}

//... 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:

SomeTestFunction();


Simple problem and solution, but I just wanted a way to dynamically add
new functions to Python with names that I control.

_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to