Repath Revit links in file opened in background

I’m a little stuck in that the script (see image) opens the document in the background, gets the revit links via the python script (extracted from the “Get Loaded RVT Links” Bakery node" and modified for document instead on the current open document.
Where it’s failing is in the Repath RevitLinkInstance all I get here is NULL.
I have used this in a test script where I manually select the link on screen and repath it successfully.
Any help would be appreciated.

TIA… Eddie

Pop open the failing custom node, copy all of the contents, switch back to the primary environment, paste the nodes into the workspace, and wire them up. Review any of those warnings in detail.

Did as you suggested… see image.

Python Error:
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 24, in
AttributeError: ‘NoneType’ object has no attribute ‘LoadFrom’

The python script is as follows.

import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
from System.Collections.Generic import *
doc = DocumentManager.Instance.CurrentDBDocument

def tolist(obj1):
    if hasattr(obj1,"__iter__"): return obj1
    else: return [obj1]

linkInstances = tolist(UnwrapElement(IN[0]))
paths = tolist(IN[1])
reloadedlinks = []

TransactionManager.Instance.ForceCloseTransaction()
for i,j in zip(linkInstances,paths):
	filepaths = FilePath(j)
	RevitLinkType  = doc.GetElement(i.GetTypeId())
	RevitLinkType.LoadFrom(filepaths,None)
	reloadedlinks.append(RevitLinkType)

OUT= reloadedlinks

What are you feeding into the node? For now you should be using a single link instance and a single path (because outside of the custom node environment you need to explicitly call out the loops for each otherwise). Confirm the data type on each.

After that is confirmed if it still causes issues comment out every line from the RevitLinkType.LoadFrom line to the end, and put a new line OUT = RevitLinkType so we can see if it’s just failing to get that element.

That might be the issue, I’m feeding 3 link instances with 3 different paths to the node… :thinking: