Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Rename an active document (Part File) using a Python script

Message 1 of 3
179 Views, 2 Replies

Rename an active document (Part File) using a Python script

Can anybody help?


Is it possible to rename the currently active fusion 360 document (Part File) using a Python script?


For example,


Say I have a part currently open called "TEST-A", can I change its document name to "TEST-B"???


Many thanks in advance!



Message 2 of 3
in reply to: isocam

@isocam Below is the code that will change the name of the active document.

import adsk.core, adsk.fusion,, traceback

def run(context):
    ui = None
        app = adsk.core.Application.get()
        ui  = app.userInterface
        doc = app.activeDocument
        ui.messageBox(f"Name of the document before renaming: {}")  = "NewName"
        ui.messageBox(f"Name of the document after renaming: {}")

        if ui:


If my reply was helpful, please click the "Accept as Solution" button. It helps others get the answer quickly! A "Like" is always welcomed.

Rushikesh Kadam
Senior QA Engineer
Quality Assurance
Autodesk, Inc.

Message 3 of 3
in reply to: isocam

I happened to be looking at this a couple of weeks ago and here's what I found. 

  • You can edit the document's name using the property IF the document has not been saved. The name you provide will be the default name in the dialog when the user saves the document. They can edit this name in the dialog to whatever they want.
  • If the document has been saved, you can still set the name using the property, but Fusion will ignore this change and set it back to the saved name. The API should document this behavior and should probably fail in that case because you're doing something that is not supported.
  • Because the file has been saved, the file on the cloud is the master copy. To change the name you need to change that name. You can do that with the code below, where "doc" is the variable name referencing a Document object. = 'New Name'​

The code above will fail if the document has not been saved because there isn't a DataFile for it.


Brian Ekins
Inventor and Fusion 360 API Expert

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th

Autodesk Design & Make Report