Not the most beautiful solution, but
if hasattr(aqt.mw.app.activeWindow(), "editor"):
editor = aqt.mw.app.activeWindow().editor
Not the most beautiful solution, but
if hasattr(aqt.mw.app.activeWindow(), "editor"):
editor = aqt.mw.app.activeWindow().editor