tags:

views:

32

answers:

0

I have a application which reads UI layout and logic from an XML file. The logic is done using IronPython (2.x), and I have found several locations where it would be very nice to have some code reuse. My preferred way to do this would be something like the following:

<Layout>
    <Module name="MyModule"><![CDATA[
        def SayHello():
            print "Hello World!"
    ]]></Module>
    <Script><![CDATA[
        import MyModule
        MyModule.SayHello()
    ]]></Script>
</Layout>

The question is, how could would I expose the code in the Module node to IronPython as a python module that could then be accessed from other scripts. If that's not possible, does anyone have any suggestions for how to achieve something similar?