Limit number of class instances with python
问题 Μy Mainclass creates a simple QmainWindows like this: class mcManageUiC(QtGui.QMainWindow): def __init__(self): super(mcManageUiC, self).__init__() self.initUI() def initUI(self): self.show() And at the end of my file I launch it like this: def main(): app = QtGui.QApplication(sys.argv) renderManagerVar = mcManageUiC() sys.exit(app.exec_()) if __name__ == '__main__': main() My problem is that each time i source it, it launches a new window. I would like to know if there is a way to detect