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

I did that first but he said it started segfaulting when he ran it again. I didn't understand why it would so I thought I would try this.