Identify status of each link

Hello everyone, i’m trying to make a node with python to help me get the status of each linked revit file of my project. But i’m facing several problems.
1 - it’s getting the linked files of the linked files, which is making the routine slower…
2 - For some reason is showing me random file. it shows me 3 of the 7 files which are really linked and the linked files of the linked file’s status…
i basically need to get the name of the linked Revit files of my project and its status. “Not found” “Loaded” bla bla bla without the nested links, because further i’m gonna play another node to Repath linked files with status “Not found”. This is what i did till now.

import clr
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import System
from System.IO import Path

def abrir_documento(file_path):
    app = DocumentManager.Instance.CurrentUIApplication.Application
    options = OpenOptions()
    model_path = ModelPathUtils.ConvertUserVisiblePathToModelPath(file_path)
    return app.OpenDocumentFile(model_path, options)

def classificar_vinculos(doc):
    tipos = FilteredElementCollector(doc).OfClass(RevitLinkType).ToElements()
    grupos = {'ARQ': [], 'HID': [], 'ELE': []}
    for tipo in tipos:
        ext_ref = tipo.GetExternalFileReference()
        if ext_ref:
            visivel = ModelPathUtils.ConvertModelPathToUserVisiblePath(ext_ref.GetPath())
            nome = Path.GetFileName(visivel)
            if len(nome) >= 39:
                ch = nome[38]
                if ch == 'A':
                    grupos['ARQ'].append(nome)
                elif ch == 'H':
                    grupos['HID'].append(nome)
                elif ch == 'E':
                    grupos['ELE'].append(nome)
    return grupos

entrada = IN[0]
resultados = []

if entrada and isinstance(entrada, list):
    for caminho in entrada:
        try:
            doc = abrir_documento(caminho)
            grupos = classificar_vinculos(doc)
            resultados.append(grupos)
            doc.Close(False)
        except Exception as e:
            resultados.append("Erro ao processar {}: {}".format(caminho, str(e)))
else:
    resultados.append("Entrada inválida: esperada lista de caminhos")

OUT = resultados

Hi @arquiteturadorafael and welcome

try this property

and this method (static)