[IronPython] C# and IronPython

Dino Viehland dinov at exchange.microsoft.com
Mon Aug 6 18:14:34 CEST 2007


Yes, as long as the class is also public.  You just need to start ipy.exe in the directory where your exe's at and then do:

import clr
clr.AddReference('MyApplication')
from MyApplicationsNamespace import MyApplicationsClass  # if it's in a particular namespace
                or
import MyApplicationsClass # if it's in the global namespace
MyApplicationsClass.Main('arg1', 'arg2', 'arg3')
                Or
MyApplicationsClass.SomeOtherMethod()
                Or
x = MyApplicationsClass()
x.SomeInstanceMethod()


From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of sms rku
Sent: Sunday, August 05, 2007 10:03 PM
To: users at lists.ironpython.com
Subject: [IronPython] C# and IronPython

I am very new to Python and IronPython.

Could you please let me know if it is possible to

Make my application [.exe] that has a static Main method and 3 other public methods defined in a class to be accessed from IronPython script?

i.e, Will I be able to create instance of the class from IronPython script?
      Will I be able to call the public methods from the script?

and also, is it possible to call the main function from the script?       [ i.e run my application]

If yes, could you please tell me how it can be done?

Thanks in advance
sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20070806/8a531fb4/attachment.html>


More information about the Ironpython-users mailing list