Xref Single File to Multiple DWGs Using Dynamo

Is there a way to xref a file to multiple DWGs using Dynamo nodes? I see a camber node for adding xref. Just not sure how I would use that node to add an xref to multiple DWGs

This is possible using Python and the AutoCAD API by sideloading files as Database objects

def attachexternalreference(filepath, xrefpath, xrefname, insertpoint=Point3d(0, 0, 0)):
    # Create the database and start a transaction
    with Database(False, True) as db:
        # Load in the file
        db.ReadDwgFile(filepath, FileShare.ReadWrite, False, "")
        with db.TransactionManager.StartTransaction() as t:

            # Attach reference to the db
            xrefid = db.AttachXref(xrefpath, xrefname)

            # If a valid reference is created then continue
            if not xrefid.IsNull:
                bref = BlockReference(insertpoint, xrefid)

                # Append the DWG reference to the current space
                btr = t.GetObject(db.CurrentSpaceId, OpenMode.ForWrite)
                btr.AppendEntity(bref)
                t.AddNewlyCreatedDBObject(bref, True)

            # Commit the new objects to the database
            t.Commit()
            
        # Save the database back to the file
        db.SaveAs(filepath, DwgVersion.Current)

Include from System.IO import FileShare with your standard imports

I am not able to get this code to work at this time. Do you see my issue?

# Load the Python Standard and DesignScript Libraries
import sys
import clr

# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')

# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *

# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

from System.IO import FileShare

filepath = IN[0]
xrefpath = IN[1]
xrefname = IN[2]

def attachexternalreference(filepath, xrefpath, xrefname, insertpoint=Point3d(0, 0, 0)):
    # Create the database and start a transaction
    with Database(False, True) as db:
        # Load in the file
        db.ReadDwgFile(filepath, FileShare.ReadWrite, False, "")
        with db.TransactionManager.StartTransaction() as t:

            # Attach reference to the db
            xrefid = db.AttachXref(xrefpath, xrefname)

            # If a valid reference is created then continue
            if not xrefid.IsNull:
                bref = BlockReference(insertpoint, xrefid)

                # Append the DWG reference to the current space
                btr = t.GetObject(db.CurrentSpaceId, OpenMode.ForWrite)
                btr.AppendEntity(bref)
                t.AddNewlyCreatedDBObject(bref, True)

            # Commit the new objects to the database
            t.Commit()
            
        # Save the database back to the file
        db.SaveAs(filepath, DwgVersion.Current)