here is a python way to do the sameimport pymel.core as pmclass UI(object): def __init__(self): if pm.window('cubeTest', exists=True): pm.deleteUI('cubeTest') with pm.window('cubeTest', title='Create Cube', width=50, height=100) as window: with pm.columnLayout(): pm.button(l='Create Cube', w=150, c=self.CreateCube) def…