You can try replacing your `def run(self):` function in your script for the one below which should do something you want: def run(self): """Run method that performs all the real work""" # show the dialog self.dlg.show() # Get all loaded layers in the interface layers = self.iface.legendInterface().layers() # Create an empty list which we can populate layer_list = [] # For every item (which we call "layer") in all loaded layers for layer in layers: # Add it to the list layer_list.append(layer.name()) # Clear comboBox (useful so we don't create duplicate items in list) self.dlg.comboBox.clear() # Add all items in list to comboBox self.dlg.comboBox.addItems(layer_list) # Clear comboBox_2 self.dlg.comboBox_2.clear() # Add all items in list to comboBox_2 self.dlg.comboBox_2.addItems(layer_list) def layer_field(): # Identify selected layer by its index selectedLayerIndex = self.dlg.comboBox.currentIndex() selectedLayer = layers[selectedLayerIndex] # Identify fields of the selected layer fields = selectedLayer.pendingFields() # Get field names of the fields fieldnames = [field.name() for field in fields] # Clear comboBox_5 self.dlg.comboBox_5.clear() # Add field names to comboBox_5 self.dlg.comboBox_5.addItems(fieldnames) def table_field(): # Same comments as above selectedLayerIndex = self.dlg.comboBox_2.currentIndex() selectedLayer = layers[selectedLayerIndex] fields = selectedLayer.pendingFields() fieldnames = [field.name() for field in fields] self.dlg.comboBox_3.clear() self.dlg.comboBox_3.addItems(fieldnames) self.dlg.comboBox_4.clear() self.dlg.comboBox_4.addItems(fieldnames) # When changing layer in comboBox, run the function "layer_field()" # to refresh the field names in the associated comboBoxes self.dlg.comboBox.currentIndexChanged.connect(layer_field) self.dlg.comboBox_2.currentIndexChanged.connect(table_field)