<s>[INST] How do I fix PyDev "Undefined variable from import" errors? I've got a Python project using PyDev in Eclipse, and PyDev keeps generating false errors for my code.  I have a module settings that defines a settings object.  I import that in module b and assign an attribute with:
from settings import settings
settings.main = object()

In some of my code--but not all of it, statements like:
from settings import settings
print settings.main 

... generate "Undefined variable from import: main" messages in the Eclipse code error pane, even though the code runs without a problem.  How can I correct these?
 [/INST] For code in your project, the only way is adding a comment saying that you expected that (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).
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.
If it was some external module, you could add it to the forced builtins so that it was forced to be analyzed by a running shell with runtime information (see http://pydev.org/manual_101_interpreter.html for details).
Another option could be creating a 'stub' yourself and adding it to the 'predefined' completions (http://pydev.org/manual_101_interpreter.html also has details on that).
 </s>