[IronPython] How to place static class in script name space

Tom Unger TomU at MITEM.com
Mon Jun 13 10:16:21 PDT 2011


I am using IronPython for scripting an application.  To make writing scripts
easier I want to place several objects in the script name space so they can
be easily used.  I got stuck with how to place a reference to a static
object, "App", in the name space.  This is probably a simple operation and
just don't know what it is.
 
1. Python import works:
 
            from AppFrame import App
 
gives the script access to the static fields and methods on App.
 
But I want to eliminate the need for each script to do that import by
setting up the scope with:
 
   scriptScope.SetVariable("App", App);

This does not compile because App is a static class, not an object.  
 
How does my hosing application place a reference to the static class in the
script's scope such that it can be used as if it was imported?
 
Thanks
 
Tom
Seattle
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ironpython.com/pipermail/users-ironpython.com/attachments/20110613/88211e49/attachment.htm>


More information about the Users mailing list