def reload_qt():

    # Clear any forbidden modules
    _import_hook._forbidden.clear()

    # Quit app if active
    global qapp
    if qapp is not None:
        qapp.quit()
        qapp = None

    global QtCore
    global QtGui

    if os.environ.get('QT_API') == QT_API_PYQT5:
        loaders = [_load_pyqt5]
    elif os.environ.get('QT_API') == QT_API_PYSIDE:
        loaders = [_load_pyside, _load_pyqt4]
    else:
        loaders = [_load_pyqt4, _load_pyside, _load_pyqt5]

    msgs = []

    # acutally do the loading
    for loader in loaders:
        try:
            loader()
            # we set this env var, since IPython also looks for it
            os.environ['QT_API'] = QT_API
            QtCore = sys.modules[__name__ + '.QtCore']
            QtGui = sys.modules[__name__ + '.QtGui']
            break
        except ImportError as e:
            msgs.append(str(e))
            pass
    else:
        raise ImportError("Could not find a suitable QT installation."
                          " Encountered the following errors: %s" %
                          '\n'.join(msgs))

    # We patch this only now, once QtCore and QtGui are defined
    if is_pyside() or is_pyqt4():
        patch_qcombobox()

    # For PySide, we need to create a loadUi function
    if is_pyside():
        patch_loadui()
Reload the Qt bindings.
dataset/ETHPy150Open glue-viz/glue/glue/external/qt.py/reload_qt