PyCharm not resolving import

已完成

Pycharm is consistently not resolving the "baselines" import (but it runs fine).  I'm really not sure why!

 

 

What I've tried:

The parent directory is marked as a sources root, and sources are added to the PYTHONPATH:

I did "pip install -e", and pip lists baselines as installed:

I collect type information, in case this also collects info about imports.

 

0

Hi,

Looking at the screenshots, marking baselines directory as Sources should do the trick or using the whole path (bacelines.baselines.).

Could you please upload your sample project and idea.log (Help | Show Log in...) zipped to https://uploads.services.jetbrains.com/ and let me know the name of that zip file?

0
Avatar
Permanently deleted user

Thanks.  I tried marking baselines directory as source root, however it still does not work

I've reproduced the issue in dummy projects I just made.  The issue seems to relate to having 2 projects in the same window, and the sources root only applies within a project (?).  How to make PyCharm resolve imports from another project?  I uploaded this as pycharm_unresolved.zip


 

 

0

pycharm_unresolved.zip contains only one empty folder.

>How to make PyCharm resolve imports from another project?

Please see https://stackoverflow.com/questions/39648578/in-pycharm-how-do-you-add-a-directory-from-one-project-as-a-source-to-another-p?answertab=votes#tab-top

0
Avatar
Permanently deleted user

Thanks!  I detached the baselines project, then added it as a content root (and then a source directory) of my other project, and now the imports resolve.

0

请先登录再写评论。