I have the same problem with TurboGears (SQLAlchemy) model classes. All members which are dynamically added give this "undefined variable" errors. Very annoying, because these classes are used a lot in TurboGears/SQLAlchemy.