def _bootstrapGCCache(self): app = QApplication.instance() if not hasattr(app, "_windowCache"): app._windowCache = set() app._windowCache.add(self)