First background (if it helps):
My application is a web platform recently updated to version 3.5.NET Framework but not using Master Pages / User Controls. This is more like an MVC pattern (albeit a lot older) and outputs a clean HTML stream from the response stream from the patterns. Python expressions allow you to follow some rules and patterns.
Old way
When embedding the IronPython 1.x engine in C #, we were able to execute code, for example:
PythonEngine pe = new PythonEngine(); Assembly a = Assembly.LoadFile("path to assembly"); pe.LoadAssembly(a); pe.Import("Script");
There is no Import () method in ipy 2.0, and the ImportModule () method does not work the same. Import () made it easier to place a line in each python script we write, for example:
from MyAssembly import MyClass
The fact that MyClass is filled with static methods means that calls to MyClass.MyMethod () work very well. I can't just initialize the object and assign it to a variable in scope, because the assembly that contains MyClass is dynamically loaded at run time.
Now about the problem
I took apart all the other parts of IronPython 2.0 integration, but would prefer not to require my executors to enter "from MyAssembly import MyClass" at the top of every script they write (it just seems silly when it was not needed in ipy 1.x) and will probably be a support issue for a while.
And finally, the question
Has anyone had this problem and resolved it? Am I doing the wrong way for DLR? or am i missing something obvious?
I'm not sure of the details that anyone needs to help, but I hope this is enough.
source share