I am making a game using pygame and PyDev. Whenever I reference any member of the pygame module (i. e. pygame.init
), PyDev gives an "undefined variable from import" error, even though the code itself is perfectly fine. Members of submodules don't give this error message, and using from pygame.locals import *
gives "undefined variable" errors.
I have tried adding pygame as a forced builtin, to no avail. I tried it again and it worked. I'm not sure what had happened before.
Code:
import pygame
pygame.init() <== Error raised here
Have you tried adding pygame
to the Forced Builtins
?
You can find more information on how to do that and why this may fix your issue at: http://www.pydev.org/manual_101_interpreter.html#PyDevInterpreterConfiguration-ForcedBuiltins