def dbg(*args, **kwds):
 mkQApp()
 from . import console
 c = console.ConsoleWidget(*args, **kwds)
 c.catchAllExceptions()
 c.show()
 global consoles
 try:
  consoles.append(c)
 except NameError:
  consoles = [c]
 return c

def dbg ( * args , ** kwds ) : mkQApp ( ) from . import console c = console . ConsoleWidget ( * args , ** kwds ) c . catchAllExceptions ( ) c . show ( ) global consoles try : consoles . append ( c ) except NameError : consoles = [ c ] return c
looks at the stack .