In my application I'm using Iron Python to provide scripting capabilities. The problem is that embedded scripts don't see references I've linked to the app. Only solution as I understand is to manually import them from script
import clr
clr.AddReference(...)
from ... import ...
but I'm reading scripts from files and I don't want to prepend a bunch of imports like this. So how do I add references from host application? ScriptEngine / ScriptScope doesn't look to have any related methods :(
The method you want is ScriptRuntime.LoadAssembly
, easily accessed from your ScriptEngine instance:
engine.Runtime.LoadAssembly(typeof(System.Web.HttpContext).Assembly);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With