Hello! I have had trouble getting my scripts to not give an error the first time they run in any maya version using python3. The second time it creates the window fine, I am not sure what should be different as it doesn’t look like a python 2 vs 3 thing to me. It works fine in python 2 Maya versions.
I’ll init a class with this:
class Window_UI:
def __init__(self):
if pm.window('myWindow', exists=True):
pm.deleteUI('myWindow')
self.window_id = 'myWindow'
The first time always gives the error:
Error: RuntimeError: file C:\Program Files\Autodesk\Maya2023\Python\lib\site-packages\pymel\internal\pmcmds.py line 217: Object ‘myWindow’ not found.
Then it works from that point on. What’s wrong with my code?
Thanks!