Pycharm: “unresolved reference” error on the IDE when opening a working project

The key is to mark your source directory as a source root. Try the following:

  • In the Project view, right-click on the Python source directory
  • In the dialog menu select Mark Directory As > Source Root

The folder should now appear blue instead of beige, to indicate it is a Python source folder.

You can also configure this in PyCharm preferences by doing the following for a project that is already in PyCharm:

  • In the Mac toolbar, select PyCharm > Preferences
  • In the window that opens, select Project Structure from the menu pane on the left
  • Select your project in the middle pane, if necessary
  • Right-click on your Python source in the right pane and select Sources from the menu dialog

Leave a Comment