UMR not reloading modules, when imported as entire .py file
Issue Report Checklist
- Searched the issues page for similar reports
- Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
- Reproduced the issue after updating with
conda update spyder(orpip, if not using Anaconda) - Could not reproduce inside
jupyter qtconsole(if console-related) - Tried basic troubleshooting (if a bug/error)
- Restarted Spyder
- Reset preferences with
spyder --reset - Reinstalled the latest version of Anaconda
- Tried the other applicable steps from the Troubleshooting Guide
- Completed the Problem Description, Steps to Reproduce and Version sections below
Problem Description
I am experiencing that Spyder UMR does not reload modules, when import these modules as an entire .py file.
So, for instance, in my project, I have a folder called "Modules". In this folder I have several .py files, which I use as different modules in my project.
If I import a specific function (my_func) within a module (my_module.py file located in the Modules folder), using:
from Modules.my_module import my_func
The UMR manages to reload the my_module every time.
If I just import the module directly using:
from Modules import my_module
The UMR does not reload the my_module module
These modules typically contain more than one function, so it convenient for me to import an entire module instead of importing the specific functions within the module.
Is there a way to fix this, or do I have to import the functions individually, to get the UMR function to work as intended?
What steps reproduce the problem?
from Modules import my_module- run whatever script that is using my_module
What is the expected output? What do you see instead?
I expected that my_module is being reloaded every time I run the script, which then uses my_module.my_func() at some point.
But this is only the case, when I import the function specifically as
from Modules.my_module import my_func
Versions
- Spyder version: 5.3.3
- Python version: 3.10.9
- Qt version: 5.15.2
- PyQt version: 5.15.7
- Operating System name/version: Windows 10
Source: spyder-ide/spyder