[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Checking For Pygame



Kris Schnee wrote:
Right now the function itself says "import pygame," but I'd like to account for the possibility that pygame will already be loaded when the file it's a part of is incorporated into a bigger project.

If you're trying to avoid loading the module twice, there's no need. A given module is only loaded into memory once per program. Subsequent import statements for the same module just return another reference to the previously loaded module object.

So just go ahead and import it wherever you need
it.

--
Greg