Pick and Read Linked Rooms

# Imports
from Autodesk.Revit.UI.Selection import *

# ISelectionFilter Class
class LinkedRoomSelectionFilter(ISelectionFilter):
    def __init__(self, doc):
        self.doc = doc

    def AllowElement(self, element):
        return True

    def AllowReference(self, reference, position):
        revit_link_instance = self.doc.GetElement(reference.ElementId)
        if isinstance(revit_link_instance, RevitLinkInstance):
            linked_doc = revit_link_instance.GetLinkDocument()
            linked_elem = linked_doc.GetElement(reference.LinkedElementId)
            if linked_elem.Category.Id == ElementId(BuiltInCategory.OST_Rooms):
                return True

# Pickobjects
selobject_link = uidoc.Selection.PickObjects(ObjectType.LinkedElement, LinkedRoomSelectionFilter(doc), 'Select rooms') # List[Reference]


# Read Picked Elements
for ref in selobject_link:
	revit_link_instance = doc.GetElement(ref.ElementId)
	linked_doc = revit_link_instance.GetLinkDocument()
	linked_elem = linked_doc.GetElement(ref.LinkedElementId)
	print(linked_elem.Name)

⌨️ Happy Coding!
Erik Frits