I am relatively new to PyQGIS and struggling to convert my simple code into a plugin class. The code works when run from the Python window, but when I add it to def run(self): I get an error. I am trying to get the plugin to display the GPSInformation window.
def run(self):
for x in iface.mainWindow().findChildren(QDockWidget):
if x.objectName() == 'GPSInformation':
x.setVisible(False)
The error says NameError: name 'QDockWidget' is not defined