namespace & imported modules

Peter Otten __peter__ at web.de
Thu Nov 25 09:14:10 CET 2004


Jason wrote:

> def main():
>     # launch WatchDog timer thread
>     bcast_watchdog = hb_global.WatchDog(timeout=3)

[...]

> The last line in hb_stethoscope.py, hb_global.bcast_watchdog.reset(),
> is _supposed_ to call the WatchDog.reset() class instance method in
> hb_global.py.

It seems you are creating bcast_watchdog as a local variable in
__main__.main(). How would you suppose it to become magically inserted in
the hb_global namespace? Do

def main():
    bcast_watchdog = hb_global.WatchDog(timeout=3)
    hb_global.bcast_watchdog = bcast_watchdog

to insert the WatchDog instance into the hb_global module. (Note that there
may be other problems as I didn't look any further)

Peter



More information about the Python-list mailing list