[IronPython] Call Python function from C#...

Bob Rosembob brosembob at yahoo.com
Fri Jun 27 07:51:39 PDT 2008

Hi there,
I apologize if this is a duplicate message. I sent this message last night but don't see it posted. Perhaps I did something wrong and message got lost. 
I need to call Python function from C# to get a value. When I call the script it executes and calculates some value, then I need to call some function to get the result. How do I do that? I have the following snippet of code that seems to execute the script, but I don't know and can't find on line, how to call a function and get value back.
I added references to my project to the following dlls:
- IronPython.dlll
- IronMath.dll
In the code I'm using the following:
Here is the code:
 PythonEngineengine = newPythonEngine();EngineModulemodule = engine.CreateModule("Test", true);try{
{@"Test\Test.py", module);catch(Exceptionex)    Console.WriteLine("Failed to execute Test.py file");}
//call the function????
So how do I do the call to the function?
Thanks for your help.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ironpython.com/pipermail/users-ironpython.com/attachments/20080627/1a6da4bc/attachment.htm>

More information about the Users mailing list