Open jennirinker opened 4 years ago
Hi @jennirinker, thanks for the report. It seems to be an odd usage, but indeed a problem. @impact27 thoughts on how we could solve this?
Is there an option to disable module reloading? This would solve this. Also we could catch the error so we could print a message along the lines of: "An import error was thrown while reloading the module {}. You can disable automatic module reloading by ..."
"Odd usage" is my middle name. :/
@impact27, do you mean like a global option to disable reloading? Because I think reloading in general is desired behaviour.
Would it be possible to have an internal flag that tracks the last-run cwd and compares with the current cwd on execution? Then, if the directories are different, it reimports modules? Sorry if this solution isn't implementable, I'm not familiar with the inner workings of spyder's executions.
The only way to avoid this would be to add an option so users can exclude particular directories from the reload mechanism.
@impact27, what do you think?
CWD is not a really good way because it can change while the code executes, so it is not robust. Excluding directories sounds more reasonable.
Agreed. @impact27, could you help us to implement this functionality?
Issue Report Checklist
conda update spyder
(orpip
, if not using Anaconda)jupyter qtconsole
(if console-related)spyder --reset
Problem Description
If I have two submodules (e.g.,
_utils.py
) in two different directories and I have loaded one, spyder attempts to reload the same one even after I switch working directories in the "Files" pane.What steps reproduce the problem?
_utils.py
, in two separate directories.from _utils import example 1
).from _utils import example_2
)What is the expected output? What do you see instead?
Spyder throws an ImportError if
example_2
not defined in the first submodule.Versions
Dependencies