[IronPython] When to load clr module?

Mike Hostetler hostetlerm at gmail.com
Mon Jan 9 21:26:35 CET 2006

I have a unique module that I wrote that can either get to a Java API
(via Jython) or COM API (via Python +Win32).  The scripts that access
this module generally don't know or care if they are running Java or
COM.  Now, with IP 1.0 beta, I'm trying to make add a .Net API to the
module and  am running into an issue with the clr module.

If I do an "import clr" and "clr.AddReference('/Path/To/Assembly')"
inside the module, the module can't find the object in the assembly. 
If I put both lines in the top level of the script, it works fine.

Is this expected behavior?  Is there a current way around this?

Mike Hostetler

More information about the Ironpython-users mailing list