I am running PyCharm Community Edition 2024.3.5 on Windows 11, using Python 3.13.2. I use a .venv virtual environment. In several modules of my project I do the standard 'import numpy as np'. Numpy is installed inthe environment. In all modules but one this works as expected. But in one, when I try to use np (e.g. a = np.array(3)), I get an error Unresolved reference 'np' . This happens only inside the function definition in the module. If I try a = np.array(3) outside the function definition, immediately after the import statement, I do not get an error! This behavior does not happen in any other module or for any other package, and it is driving me crazy. This code used to work recently, and I do not understand what has changed. I did play around a bit with the 'New projects setup' settings in PyCharm, but I don't believe I did anything to cause this issue. I have invalidated caches, deleted and re-created .venv and/or .idea directories, copied over the project to another directory, used other Python versions, and searched for similar issues in this forum, e.g. Issues with Importing Modules into Python Getting "NameError: np is not defined", but np is defined both in main and in imported module PyCharm from six.moves import queue: unresolved reference 'queue' Why does PyCharm give unresolved reference errors on some Numpy imports? Continue reading...