Command Line differences to Toolbar?

Hi,
I’m wondering if there are any major differences running a script from the toolbar compared to command Line ?
I’ve recently finished a tool that used to be inside a Ribbon of my own tools, but I wanted to run this in CMD using pyrevit to try and make it more of an automated process.
Nearly everything works the same, however when using TransmissionData to relink some files, some are not relinking but seems to put it in the Local Alias instead ? When the opening the file, its saying loaded and everything is there, however when I try and import this into 3ds Max, its missing the files that didn’t link correctly.
If I use this tool as a button in Revit, everything works fine, but if I use CMD to run the script, it somehow goes wrong ?
Any ideas on why this would happen ?

def relink_links(new_file_path, new_folder_path):
    # Get the central model path (useful when working with workshared models)
    central_model_path = DB.ModelPathUtils.ConvertUserVisiblePathToModelPath(new_file_path)

    # Access the TransmissionData for the central model
    transmission_data = DB.TransmissionData.ReadTransmissionData(central_model_path)

    if transmission_data is None:
        print("No transmission data found. This document might not have linked files or transmission data is not available.")
    else:
        # Iterate through all references in the TransmissionData
        for ext_ref_id in transmission_data.GetAllExternalFileReferenceIds():
            ext_ref = transmission_data.GetLastSavedReferenceData(ext_ref_id)

            # if ext_ref.ExternalFileReferenceType == DB.ExternalFileReferenceType.RevitLink:
                # Get the current path
            current_path = DB.ModelPathUtils.ConvertModelPathToUserVisiblePath(ext_ref.GetPath())
            # Get the file name from the full path
            file_name = os.path.basename(current_path)
            new_revit_link_path = find_file_in_folder(new_folder_path, file_name)
            if new_revit_link_path:
                new_revit_link_path = new_revit_link_path.replace("/", "\\")
                model_path = DB.ModelPathUtils.ConvertUserVisiblePathToModelPath(new_revit_link_path)
                transmission_data.SetDesiredReferenceData(ext_ref_id, model_path, ext_ref.PathType, True)

        # Save changes to the transmission data
        transmission_data.IsTransmitted = True
        DB.TransmissionData.WriteTransmissionData(central_model_path, transmission_data)

def find_file_in_folder(folder_path, file_name):
    for root, dirs, files in os.walk(folder_path):
        for file in files:
            if file == file_name:
                newFile = IO.Path.Combine(root, file)
                return newFile
    return None