On Thu, Oct 28, 2010 at 4:14 PM, Dino Viehland <di...@microsoft.com> wrote:
> Slide wrote:
>> I have something like the following code:
>>
>> ScriptEngine engine = Python.CreateEngine(); ScriptScope scope =
>> engine.CreateScope();
>>
>> engine.Runtime.LoadAssembly(Assembly.GetExecutingAssembly()); // holds
>> the namespace foo
>>
>> // the following line throws an exception
>> engine.Runtime.ImportModule("foo");
>>
>> // the following if executed works fine
>> engine.Execute("import foo");
>>
>>
>> I'm basically just trying to make the types in my executing assembly 
>> available
>> to the script. I assumed that the ImportModule would see things that had
>> been loaded using LoadAssembly, but this doesn't seem to be the case.
>>
>> Does anyone have examples of doing this that works?
>
>
> I think the problem here is that foo is not a PythonModule - it's a 
> NamespaceTracker
> object instead.  ImportModule can currently only support modules.  This could 
> be
> made to support namespace trackers - PythonService.ImportModule would need
> to be updated to check for a ReflectedNamespace and create a ScriptScope from 
> it.
>
>


Is it best to just Execute("import foo") to make it available then?

Thanks,

slide
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to