You are not logged in.
Pages: 1
I seem to be having a rather annoying import issue with python. I am programming a small game using pygame, I'm almost complete with it, but have become rather annoyed that my source code for it is rather ugly and unordered. I wanted to be able to remove certain segments of code, for example, enemy code, character code, ect. In different files, and just use python to access them. I figured out that from <blah> import * would be the best way, but since some of the code, image directories ect, is in the main program, the other modules complain about not being able to access the images, saying they don't exsist. I tried module.Img.character and still the same error persist. Any ideas on what I am doign wrong?
Offline
I'm not quite sure what you're asking (what is 'module.Img.character' supposed to be/do?), but it sounds like you might need to move the stuff that is needed by various non-main modules out of the main module - to avoid looping dependencies.
Also 'from <blah> import *' should be used with caution, it is normally better to import names explicitly, or else just do 'import <blah>', to avoid name clashes, etc.
larch: http://larch.berlios.de
Offline
Pages: 1