From: Дамјан Георгиевски on


> Having an odd problem that I solved, but wondering if its the best
> solution (seems like a bit of a hack).
>
> First off, I'm using an external DLL that requires static callbacks,
> but because of this, I'm losing instance info. It could be import
> related? It will make more sense after I diagram it:

> ---------------------------------------------------------------------
> So basically I added a list of instances to the base class so I can
> get at them from the staticmethod.

Have you tried using a closure, something like this:

class A:
def call(self, args):
def callback(a, b): # normal function
# but I can access self here too
call_the_dll_function(callback, args1, args2...)


> What's bothering me the most is I can't use the global app instance in
> the A.py module.
>
> How can I get at the app instance (currently I'm storing that along
> with the class instance in the constructor)?
> Is there another way to do this that's not such a hack?
>
> Sorry for the double / partial post :(

--
дамјан ((( http://damjan.softver.org.mk/ )))

Q: What's tiny and yellow and very, very, dangerous?
A: A canary with the super-user password.