Hot-swapping Python 3 code
Hot reloading is next to impossible to do safely in the general case in Python, and this library is really basic and doesn’t really do anything special.<p>The only case where it does work is if you maintain a single reference to the module you wish to reload, _and_ the target module doesn’t load any C extensions, _and_ it doesn’t create state outside its module (very easy to do accidentally).<p>That’s why every autoreloader implementation restarts the whole process when any change is made, because how would you even detect that it was safe to hot reload something in the general case let alone actually hot reload it safely?<p>If you need to add an autoreloader to your project use Hupper[1]. If you’re weird like me and you’re interested in autoreloaders, check out the Django[2] and Flask[3] implementations or my talk[4] for more details.<p>1. <a href="https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;hupper&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;hupper&#x2F;</a><p>2. <a href="https:&#x2F;&#x2F;github.com&#x2F;django&#x2F;django&#x2F;blob&#x2F;master&#x2F;django&#x2F;utils&#x2F;autoreload.py" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;django&#x2F;django&#x2F;blob&#x2F;master&#x2F;django&#x2F;utils&#x2F;au...</a><p>3. <a href="https:&#x2F;&#x2F;github.com&#x2F;pallets&#x2F;werkzeug&#x2F;blob&#x2F;master&#x2F;src&#x2F;werkzeug&#x2F;_reloader.py" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pallets&#x2F;werkzeug&#x2F;blob&#x2F;master&#x2F;src&#x2F;werkzeug...</a><p>4. <a href="https:&#x2F;&#x2F;youtu.be&#x2F;IghyoR6ld60" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;IghyoR6ld60</a>