<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Reread Setting.py while the program is running.]]></title><description><![CDATA[<p dir="auto">Reread <a href="http://Setting.py" target="_blank" rel="noopener noreferrer nofollow">Setting.py</a> while the program is running.<br />
How can I reload a setting file which I read in by Import Setting at the beginning of the program without leaving the <a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow">main.py</a> or starting a reset?</p>
<p dir="auto">Problem: I have a setting file that I can update online. However, the new data is not taken over in the variables, but only when I reboot.<br />
How can I do it without restarting.<br />
I am using a While True loop in the <a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow">main.py</a>.</p>
<p dir="auto">Translated with <a href="http://www.DeepL.com/Translator" target="_blank" rel="noopener noreferrer nofollow">www.DeepL.com/Translator</a></p>
]]></description><link>https://forum.pycom.io/topic/5296/reread-setting-py-while-the-program-is-running</link><generator>RSS for Node</generator><lastBuildDate>Wed, 12 Aug 2026 14:14:47 GMT</lastBuildDate><atom:link href="https://forum.pycom.io/topic/5296.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 18 Oct 2019 07:33:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Reread Setting.py while the program is running. on Fri, 18 Oct 2019 07:33:26 GMT]]></title><description><![CDATA[<p dir="auto">Reread <a href="http://Setting.py" target="_blank" rel="noopener noreferrer nofollow">Setting.py</a> while the program is running.<br />
How can I reload a setting file which I read in by Import Setting at the beginning of the program without leaving the <a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow">main.py</a> or starting a reset?</p>
<p dir="auto">Problem: I have a setting file that I can update online. However, the new data is not taken over in the variables, but only when I reboot.<br />
How can I do it without restarting.<br />
I am using a While True loop in the <a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow">main.py</a>.</p>
<p dir="auto">Translated with <a href="http://www.DeepL.com/Translator" target="_blank" rel="noopener noreferrer nofollow">www.DeepL.com/Translator</a></p>
]]></description><link>https://forum.pycom.io/post/29886</link><guid isPermaLink="true">https://forum.pycom.io/post/29886</guid><dc:creator><![CDATA[Wolli01]]></dc:creator><pubDate>Fri, 18 Oct 2019 07:33:26 GMT</pubDate></item><item><title><![CDATA[Reply to Reread Setting.py while the program is running. on Fri, 18 Oct 2019 08:03:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/3568">@Wolli01</a> I use this little function:</p>
<pre><code>#
# reload module: 
#
def reload(mod):
    import sys
    mod_name = mod.__name__
    del sys.modules[mod_name]
    return __import__(mod_name)


</code></pre>
<p dir="auto">You would call it with:<br />
reload(Setting)</p>
]]></description><link>https://forum.pycom.io/post/29888</link><guid isPermaLink="true">https://forum.pycom.io/post/29888</guid><dc:creator><![CDATA[robert-hh]]></dc:creator><pubDate>Fri, 18 Oct 2019 08:03:50 GMT</pubDate></item><item><title><![CDATA[Reply to Reread Setting.py while the program is running. on Fri, 18 Oct 2019 08:07:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/98">@robert-hh</a> Thank You</p>
]]></description><link>https://forum.pycom.io/post/29889</link><guid isPermaLink="true">https://forum.pycom.io/post/29889</guid><dc:creator><![CDATA[Wolli01]]></dc:creator><pubDate>Fri, 18 Oct 2019 08:07:33 GMT</pubDate></item><item><title><![CDATA[Reply to Reread Setting.py while the program is running. on Fri, 18 Oct 2019 08:52:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/98">@robert-hh</a> Wie rufe ich das auf?</p>
]]></description><link>https://forum.pycom.io/post/29892</link><guid isPermaLink="true">https://forum.pycom.io/post/29892</guid><dc:creator><![CDATA[Wolli01]]></dc:creator><pubDate>Fri, 18 Oct 2019 08:52:20 GMT</pubDate></item><item><title><![CDATA[Reply to Reread Setting.py while the program is running. on Fri, 18 Oct 2019 10:44:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/3568">@Wolli01</a><br />
Preload:<br />
from reload import *<br />
then:<br />
reload(Setting)</p>
<p dir="auto">Instead of this function, you can also simply use that sequence directly:</p>
<pre><code>import sys
del sys.modules['Setting']
import Setting
</code></pre>
<p dir="auto">You have to take care, in which namespace you are calling it.</p>
]]></description><link>https://forum.pycom.io/post/29894</link><guid isPermaLink="true">https://forum.pycom.io/post/29894</guid><dc:creator><![CDATA[robert-hh]]></dc:creator><pubDate>Fri, 18 Oct 2019 10:44:22 GMT</pubDate></item><item><title><![CDATA[Reply to Reread Setting.py while the program is running. on Fri, 18 Oct 2019 10:20:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/98">@robert-hh</a><br />
import sys<br />
del sys.modules('settings')<br />
time.sleep(1)<br />
import settings</p>
<p dir="auto">File &quot;<a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow">main.py</a>&quot;, line 290, in &lt;module&gt;<br />
SyntaxError: can't delete expression</p>
]]></description><link>https://forum.pycom.io/post/29896</link><guid isPermaLink="true">https://forum.pycom.io/post/29896</guid><dc:creator><![CDATA[Wolli01]]></dc:creator><pubDate>Fri, 18 Oct 2019 10:20:06 GMT</pubDate></item><item><title><![CDATA[Reply to Reread Setting.py while the program is running. on Fri, 18 Oct 2019 10:43:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/3568">@Wolli01</a> Yes. Obviously it is:</p>
<p dir="auto">del sys.modules['settings']</p>
<p dir="auto">since sys.modules is a dictionary. This del does not delete the old module, but only allows to reload it.</p>
]]></description><link>https://forum.pycom.io/post/29897</link><guid isPermaLink="true">https://forum.pycom.io/post/29897</guid><dc:creator><![CDATA[robert-hh]]></dc:creator><pubDate>Fri, 18 Oct 2019 10:43:37 GMT</pubDate></item><item><title><![CDATA[Reply to Reread Setting.py while the program is running. on Fri, 18 Oct 2019 11:10:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/98">@robert-hh</a><br />
That's how it works perfectly!<br />
Thank you very much.</p>
<pre><code>            import sys
            del sys.modules['settings']
            time.sleep(1)
            import settings</code></pre>
]]></description><link>https://forum.pycom.io/post/29898</link><guid isPermaLink="true">https://forum.pycom.io/post/29898</guid><dc:creator><![CDATA[Wolli01]]></dc:creator><pubDate>Fri, 18 Oct 2019 11:10:00 GMT</pubDate></item></channel></rss>