# Error: 'myTool' object has no attribute 'event' # with pyside tool dev in maya

Hi,

i am consistently running into an issue while i’m trying to develop new tools. every time i introduce an error and launch the tool, i first get the correct message about the error, but often (if not always) the tool cannot be closed anymore and launching it new takes a few attempts. at the first attempt i get the message i posted in the title. after a few of these i have to restart maya to get going again. here’s the boilerplate i am using:

code to launch from the maya script editor

if 'myTool' in globals():
    reload(myTool)
else:
    import myTool

myTool.show_ui()

show ui function

def show_ui():
    global myTool
    try:
        myTool.close()
        myTool.deleteLater()
    except:
        pass

    myTool = MyTool()

there are problems with reloading modules that contain QtGuis. After a certain number of reloads, the GUI will fail to load and you’ll strange error messages about winevents.

the only workaround is to restart maya each time you need to reload the GUI module.

Covered in detail on this thread.

Thanks so much. the other thread had some helpful info.