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

Can you do this here instead and avoid the try/catch?

    if 'PyQt5' in sys.modules: