Issue with code completion of manually added source

I have a directory say
/home/abc/ which has inside gi/repository/ with both being valid packages.Inside repository I have various .py files with various classes inside

I want code completion according to the package layout inside this directory. So quite simply, I added it in Project Settings>Project Structure>Add content root.

Now if I type 'import g' then it shows the 'gi' autocompletion with path /home/abc/gi. Good.

But AFTER that if I type 'import gi.repo' it is not able to locate the 'repository' package which is at '/home/abc/gi/repository'. Instead it shows /usr/lib/python2.7/dist-packages/gi/repository.

So clearly the issue here is that I'm 'overriding' the 'gi' package from /usr/lib/python2.7/dist-packages/gi with the gi package at /home/abc/gi. Pycharm correctly detects this. But at a sub package level it fails. After selecting the overridden gi package, it still thinks I've selected the /usr/lib/python2.7/dist-packages/gi/ package hence shows autocompletion based on this package.

Any clue how to solve this issue?

Some background as to why I'm trying to do this:
/usr/lib/python2.7/dist-packages/gi/ is introspected at import time so code completion isn't available. I've a mock structure of the whole gi module in /home/abc/gi which I want to use for code completion.

Please sign in to leave a comment.