You have to tell Pycharm to use Project A as another “Content Root” for Project B.
- From the upper bar, go to File -> Settings… -> Project: [yourprojectnamehere] -> Project Structure.
- Click on
+ Add Content Rootat the right panel - Select the Project A folder from the popup named
Select content root directory - Click OK
Now, you’ll see Project A is listed at the right panel.
- Click on Project A from the right panel
- Now, the content of project A is listed. Select the ones you want to be included as source. You can hold
Ctrland clickleft mouse buttonto select multiple entities. - Click
Sourcesfrom the upper bar to assign the selected entities as Source.
Now you should see Source Folders at the right panel.
UPDATE: As of at least Pycharm 2019.1.3, this seems to have changed, to be simpler thankfully.
- From the upper bar, go to File -> Settings… -> Project: [yourprojectnamehere] -> Project Dependencies.
- Select your project, and then click the checkboxes for each other project it’s dependent on.