Haran - you can't expose a 'module' (in the Python sense), but you can easily do what you trying to do.
The usual pattern for this would be stow away a reference to your application object in a static where the Python code can then get it. Assuming you have an assembly 'my.app', this would look like: namespace my.app { public class MyApp { public static MyApp theapp; public MyApp() { // do initialization theapp = this; } } } Now from Python you can do the following: from my.app import MyApp app = MyApp.theapp hope this helps, -Brian > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Haran Shivanan > Sent: Thursday, June 08, 2006 11:27 PM > To: pythondotnet@python.org > Subject: [Python.NET] exposing modules > > Hi, > > I'm trying to embed the python interpreter in my .NET-based program. > The basic stuff is working fine. > But now, I want to expose some of my program's internal data > to the scripts. > (ie, not just functions that live in an assembly, but access > to my live program's state) For example, if I have a WinForms > application, I want to be able to access a textbox's current > text from python. > Ideally, I should be able to do something like this from a script: > import MyApp > s = MyApp.GetText() > > Is there any way to do this in Python.NET? > And if not, can someone provide me with some pointers on how > to go about adding the functionality to the Python.NET code? > (I believe we have to use issue a call to Py_InitModule or something, > right?) > > Thanks, > Haran > _________________________________________________ > Python.NET mailing list - PythonDotNet@python.org > http://mail.python.org/mailman/listinfo/pythondotnet > > _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet