gsgx
gsgx

Reputation: 12249

Code completion for custom modules not working with PyDev

Let's say I make a module called mylib.py. In eclipse I type

import mylib

Then I type mylib. and hit CTRL+SPACE. This should suggest functions/variables in mylib, but it doesn't do anything. If I do something like import os and type os., suggestions immediately pop up, so I know code completion works in general, just not for my modules. Any reason why?

Upvotes: 1

Views: 1433

Answers (1)

FlaPer87
FlaPer87

Reputation: 1274

In order to get completion for custom modules, PyDev has to index it (if possible) and introspect the classes, functions, variables and imports defined there. To do so, you should add your module to the eclipse's PYTHONPATH and then reindex your venv (the one defined in PyDev).

Most of the times this is done automatically by the IDE but it doesn't work quite well (at least it is not perfect).

I really suggest you not to rely at 100% on the IDE completion.

Upvotes: 3

Related Questions