If I have a module in my project with all the inits configured properly and I try to import anything from this module, PyCharm does not identify what I am trying to import. It would work before but somehow it stopped working and I have no idea why.
Example:
./package/file.py
def function():
print('function')
./package/__init__.py
from .file import function
./call.py
from package import function
function()
The code executes fine but I can't use auto complete and the editor is informing an error "Unresolved reference 'function'" in the file ./call.py
Methods I tried that did not work:
- Invalidate Caches / Restart
- Use different the interpreter (but still using conda)
- CTRL + Space doesn't show anything I need
- Tab doesn't show anything I need
- Restart PyCharm
EDIT0:
If I use import package
the autocomplete works fine displaying the functions (package.function
) to use while in the Python Console, but still doesn't work in the editor.
EDIT1: I tried to mark the directory as Source Root and it did not work
EDIT2: Tried uninstalling from snap and installing it all back again after removing all files from /home/usr/.PyCharm* and it is working fine.