[IronPython] How to force ipy-engine to reload imported modules ?

Langer, Jochen ALRT/EEG2 * Jochen.Langer at al-lighting.com
Mon Feb 5 07:48:23 PST 2007


> We use IronPython-engine embedded in a C# application. The engine
> executes Python-scripts that are located in several directories with
> ExecuteFile(). The scripts import modules that are located in
> subfolders of folder of the respective script.
> 
> Doing so the following problem occurs:
> 
> 1. Executing ScriptA in DirectoryA imports Modules that are located in
> subdrectories of DirectoryA - still everything is fine
> 
> 2. Executing ScriptB in DirectoryB does not import modules if a module
> with the same name had been imported during the previous call to
> ExecuteFile("DirectoryA\ScriptA"). The previously imported modules
> (belonging to ScriptA) are used instead.
> 
> As a workaround we create a new engine prior to each execution and
> dispose it afterwards.  
> But this is not the preferred implementation - I'd rather like to have
> one static engine-object that can be used multiple times. (putting all
> scripts into the same folder or using different module-names is not an
> option due to maintainance and reuse) 
> 
> Any suggestions how the ipy-engine can be forced to reload modules
> upon each call to ExecuteFile() ?
> 
> regards,
> 
> 
> Jochen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ironpython.com/pipermail/users-ironpython.com/attachments/20070205/907882e5/attachment.htm 


More information about the users mailing list