
I want to enter the name of the Element along with the element ID, but why does it Appear Error as shown in the picture, while if only entering the Id element it works, using the code block to take the familyname also works

def selectElement(self, sender, event):
# Ensure correct import and usage of ObjectType
from Autodesk.Revit.UI.Selection import ObjectType
selected_id = uidoc.Selection.PickObject(ObjectType.Element, "Select an element")
selected_element = doc.GetElement(selected_id)
self.listbox.Items.Clear()
self.listbox.Items.Add(str(selected_element.ElementType.FamilyName),(selected_element.Id))
def run(self, sender, event):
global OUT
OUT = [elem for elem in self.listbox.Items]
self.Close()