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

Re: [pygame] setting + modifying a variable for use across the entire application



On Sat, Dec 17, 2011 at 10:15 AM, Sean Wolfe <ether.joe@xxxxxxxxx> wrote:
I'll have to dig in more to see the differences between our code.
here's what was happening though in general -- the  problem

1. main module imports settings as blank
2. main module imports child modules
3. when imported, child modules import settings, also as blank
4. main module modifies settings

so the child modules were importing the blank version of the module
rather than the verision modified later.

Yep, I understand. That definitely should have worked fine. main.settings and child.settings both refer to the same object, so modifying one will be seen on the other. Anyway, if it's not a big deal for you, you don't have to dig into it or anything, but if you find your code getting more complicated than it needs to be, it might be worth taking another look!

-Christopher