added check to ensure we do not fail if PyQt5 is not in sys.modules

You should be right. Maybe I spelled it wrong? I'll try this way again without the "and sys.modules['PyQt5']:"