<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Hi Jeff,<BR> <BR>In my simple scenario was able to update test2. I just perform the following<BR><font color="#0000ff" size="2" face="Consolas"><font color="#0000ff" size="2" face="Consolas"><font color="#0000ff" size="2" face="Consolas">var</font></font></font><font size="2" face="Consolas"><font size="2" face="Consolas">success = engine.GetSysModule().GetVariable(</font></font><font color="#a31515" size="2" face="Consolas"><font color="#a31515" size="2" face="Consolas"><font color="#a31515" size="2" face="Consolas">"modules"</font></font></font><font size="2" face="Consolas"><font size="2" face="Consolas">).Remove(</font></font><font color="#a31515" size="2" face="Consolas"><font color="#a31515" size="2" face="Consolas"><font color="#a31515" size="2" face="Consolas">"test2"</font></font></font><font size="2" face="Consolas"><font size="2" face="Consolas">);</font></font><p><font size="2" face="Consolas"><font size="2" face="Consolas"></font></font> <BR>then I perform the ImportModule on the test module and test2 was updated. I'm not sure if this is correct but I received the wanted effect. I will keep playing and thanks for the help.<BR> <BR>Danny<BR><br> <BR><div><div id="SkyDrivePlaceholder"></div>> Date: Wed, 21 Dec 2011 11:53:36 -0800<br>> Subject: Re: [Ironpython-users] Reload module within embedded C# app<br>> From: jdhardy@gmail.com<br>> To: fernandez_dan2@hotmail.com<br>> CC: ironpython-users@python.org<br>> <br>> On Wed, Dec 21, 2011 at 11:32 AM, Daniel Fernandez<br>> <fernandez_dan2@hotmail.com> wrote:<br>> > Hi Jeff,<br>> ><br>> > I downloaded NWSGI and see where you call engine.ImportModule in<br>> > the WsgiApplication.GetApplicationInfo method. It works great with that<br>> > module changes.<br>> ><br>> > I couldn't get modules that were changed from the entry module to update. I<br>> > have python script test.py that imports test2, if test2.py the changes in<br>> > the scope didn't reflect after engine.ImportModule on test.py. I was sure if<br>> > there was a way to force a reload of test2 module. I figure if I can remove<br>> > test2 module from sys.modules the next time I perform ImportModule on test<br>> > it would reload test2, but I am not sure if this makes sense.<br>> <br>> That's basically what you want to do. I'm not 100% up on the import<br>> mechanism (it's a bit hairy) but that should do what you want.<br>> <br>> The other option would be to completely recreate the ScriptEngine,<br>> which is where the modules are stored. This is a bit more<br>> time-consuming, but if scripts aren't changing constantly it shouldn't<br>> be too bad.<br>> <br>> - Jeff<br></div>                                            </div></body>
</html>