This does not make sense for most applications because you will get side effects using reload . In addition, the time spent on code that detects changes and reloads all modules can be spent simply restarting the application. This is very difficult if you import a lot of modules or have a project that contains many submodules.
In some cases, this is a good idea. The Django web environment provides a development server ( manage.py runserver ) that automatically reloads the changed modules. Take a look at django.utils.autoreload - it checks all Python files for changes using file modification time. As already mentioned, this is only a good idea for some applications. Web applications are somewhat stateless and therefore can be reloaded with minor side effects.
source share