Unresolved reference '<app_name>" on import statements

I'm getting an "Unresolved reference" error from PyCharm for apps within my project.  Python level libraries and Django imports don't cause this error.

I can run the project, tests don't fail - no troubles other than I can't use the auto-complete to see which methods are available within the app that I'm trying to import.

I've tried to invalidate the cache and restart, which has worked for me in the past.  Sadly, that is not working now.

Any suggestions?
pycharm_unresolved_reference.png
2
4 comments
What is your project structure? Most likely you need to mark the parent directory of "common" as a source root in Settings | Project Structure.
4
Avatar
Permanently deleted user
My project structure points to the project level directory

my_project/
– apps/
– __init__.py
– manage.py
– settings/
– templates/
– tests.py
– urls.py

Any other suggestions?
0
Avatar
Permanently deleted user
I'm seeing similar symptoms trying to import PyQt4.QtCore and PyQt4.QtGui.  I've tried adding "D:\Development\Python33\lib\site-packages" to my project structure but I still get 'Unused import' on the imports and Unresolved reference on all PyQt4 object references.  The code runs fine, it just seems to be the inspector complaining
0

This is an old question but it happened to me lately and I would like to share the solution that worked for me. I got it from stackoverflow/38342618 (credit where it's due). If everything is working fine but the ide won't play, right click the folder that is your project root and select mark directory ad sources root. Hope it helps.

3

Please sign in to leave a comment.