For code in your project, the only way is adding a declaration saying that you expected that — possibly protected by an if False
so that it doesn’t execute (the static code-analysis only sees what you see, not runtime info — if you opened that module yourself, you’d have no indication that main was expected).
To overcome this there are some choices:
-
If it is some external module, it’s possible to add it to the
forced builtins
so that PyDev spawns a shell for it to obtain runtime information (see http://pydev.org/manual_101_interpreter.html for details) — i.e.: mostly, PyDev will import the module in a shell and do adir(module)
anddir
on the classes found in the module to present completions and make code analysis. -
You can use Ctrl+1 (Cmd+1 for Mac) in a line with an error and PyDev will present you an option to add a comment to ignore that error.
-
It’s possible to create a
stub
module and add it to thepredefined
completions (http://pydev.org/manual_101_interpreter.html also has details on that).