Resolving references to current package outside of current source root


I've been searching for a problem like this, but have not been able to find anything like this problem.  Apologies if I missed a previous answer.

I'm working in a fairly large code base with Python code spread out across multiple subdirectories in a monorepo.  The organization looks something like this:

team1/src/python/company/foo -> import

team2/src/python/company/bar -> import

common/src/python/company/{util1,util2,util3} -> import company.{util1,util2,util3}

I have a PyCharm project with "team1/src/python" set as the source root, and I'm working on code in the package.  PyCharm is unable to resolve any references to any subpackage in company except, but the code in this package has dependencies on those other packages.  I'm working in a venv where those dependencies are symlinked in the site-packages directory.  PyCharm, though, seems to be latching on to the in team1/src/python/company and assuming that all references to items in company are in that source root and is ignoring $VENV/site-packages/company.  Is there a way to get PyCharm to look in both places when resolving imports?  I have tried manually adding the internal dependencies as separate source roots to my project, but this has the same problem (PyCharm picks one and only uses that).


Have you tried the following?

1) Add your dependencies as Content Roots

2) Use namespace packages for packages and modules with the same name



I already tried #1.  I'll try #2 and report back.


I cleaned up the extra init files per PEP420 and PyCharm is resolving things properly now.  Thanks!