I never tested it but you can try this:
try:
calling simple pygame function
except:
# ImportError
import pygame
And Im also not sure about this (prove me wrong ;) ): If you create
later on a py2exe or py2app it will be remove all the same modules to
one, so the same module will not be loaded more than once. I think I
read that once on a page. There are also module variables set you can
check if a module is loaded.
Am 14.10.2006 um 02:19 schrieb Kris Schnee:
How can I find out whether Pygame is currently loaded? I'd like to
use a function that requires Pygame to draw something, without
loading the module in the program unless that function runs?
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.
Kris