Alaa M.
Alaa M.

Reputation: 5273

How to enable code completion for custom modules in PyCharm?

When I import a module such as numpy by typing import numpy as np, and then start typing np.... Pycharm auto-completes the code and shows suggestions.

But when I import a custom module that I built (import my_module as md), typing md.... doesn't show up the inner attributes of the module (although completing the code manually works and runs successfully). How can this be achieved?

Upvotes: 3

Views: 2152

Answers (1)

vishes_shell
vishes_shell

Reputation: 23554

You need to mark(Mark Directory as) folder with your package as Sources Root.

enter image description here

Steps:

Right click on folder -> Mark Directory as -> Sources Root

UPD: Also if folder does presented in project scope, open Preferences -> Project -> Project Structure -> Add Content Root -> And mark folder containing your module as Sources

Upvotes: 7

Related Questions