[IronPython] Call methods from Python-Script

Eichhorn, Georg Georg.Eichhorn at philips.com
Wed Aug 26 07:59:31 CEST 2009


I have implemented some piece of code that should execute a python-script. In this script I want to call a c#-function.
First, I Generate a module (context to work in):

 _scriptRuntime.ScriptScope.SetVariable("class", this); ('this' is CClassName')

Then I get the class:

PythonType pType = _scriptRuntime.ScriptScope.GetVariable("CClassName") as PythonType;

Create an instance of the object

_Class = _scriptRuntime.ScriptScope.Engine.Operations.CreateInstance(pType, new object[] { });

[...] (do some other tings)

>From the python script, I want to call the function:

return class.doSomething(parameter)

The code throws an exception:

'CClassName' object has no attribute 'doSomething'.

What am I making wrong? CClassName has a public method doSomething()

Thanks for U're help.

Georg Eichhorn

The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090826/c98a7baa/attachment.html>

More information about the Ironpython-users mailing list