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

Langer, Jochen ALRT/EEG2 * Jochen.Langer at al-lighting.com
Mon Feb 5 16:48:23 CET 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://mail.python.org/pipermail/ironpython-users/attachments/20070205/907882e5/attachment.html>


More information about the Ironpython-users mailing list