HOM cookbook Qt
A PySide2 window only exists as long as there is a reference to it in Python. When you are writing your own code, if you create a window inside a function, and don't store it somewhere persistent in memory (such as hou.session), the window will disappear when Python garbage collects the window at the end of the function.