diff --git a/qtpy/__init__.py b/qtpy/__init__.py index 7ac6e66c..6a548dc3 100644 --- a/qtpy/__init__.py +++ b/qtpy/__init__.py @@ -100,9 +100,8 @@ class PythonQtWarning(Warning): PYQT5 = True PYQT6 = PYSIDE2 = PYSIDE6 = False -# When `FORCE_QT_API` is set, we disregard -# any previously imported python bindings. -if 'FORCE_QT_API' in os.environ: +# Unless `FORCE_QT_API` is set, use previously imported Qt Python bindings +if not os.environ.get('FORCE_QT_API'): if 'PyQt6' in sys.modules: API = initial_api if initial_api in PYQT6_API else 'pyqt6' elif 'PyQt5' in sys.modules: