Run dynamo definition in multiple files


I’ve created a set of dynamo definition to help with management of our family library (rename materials, set parameters, etc…) Works great, but it requires to open each file one by one and each time open Dynamo.

I was wandering is it actually possible to run a dynamo definition in multiple files?

First I was thinking about trying to create a macro to open files, open dynamo and run a definition, but with my limited coding skills it’s a bit too complicated.

Then I thought to create a code block with python script in Dynamo ,as there is no node to open a Revit Project/Family file, but I’m not sure how to tell Dynamo to switch between files.

Is it a lost cause? Or is it possible?



1 Like

Hello Maciej Wypych,

If you put your .DYF(definitions file) in following location then every-time when you launch Dynamo it will load those definitions in Library and from there you can access those definitions on every dyn file.

copy/paste you dyf here (C:\Users<strong>you user name\AppData\Roaming\Dynamo\0.7\packages)

Do let me know if that doesn’t work for you.




Hi Ritesh,

Thank you for your reply, but it seems that I wasn’t clear enough explaining my problem.

I know how to re-use the definition in different Dynamo files.

I’d like to know if you can run a Dynamo definition in multiple Revit files without opening each Revit file one by one. Or at least get away without re-opening Dynamo each time the new file is loaded to point to the current document.


Kind Regards,



Hi Maciej,

What you’re aiming to do sounds like a tall order. I’m not sure if it’s possible to open documents from inside Dynamo. However if you open them before you start Dynamo, you can query all open documents the following way:



So if you manage to convert all your tasks in a single definition as Ritesh suggested, and you make it so that it expects a document as an input every time, you should technically be able to apply all your tasks to each document opened in the UI.


It seems you can also open files from macros:

I replicated the functionality in Dynamo, but it seems to be a tad unstable sometimes.



Now the final piece of the puzzle seems to be the functionality to lock the current document.

Hi Dimitar,

Thank you so much. It’s really a great help.

That just made my day :slight_smile:

Kind Regards,


If you’re looking for a way to batch process a large amount of project or family files, you should have a look at the Revit Test Framework:

Hello Ritesh,

This is a much delayed reply to this thread,but…

With regard to your response about the definitions library, are there any alternative approaches that would allow a different user to open the file (a user without the custom node definitions in their local folder) and have full functionality? Is there a way to “bake” custom nodes into a .dyn file? Or alternatively, is there a way to define functions by codeblock that can return multiple outputs?

Best regards,


This is the only post I could find on this issue.

I tried Dimitar’s pythonscript with 2 families and a project open but got an error:

docs = Application().Documents returns null.

Even so I don’t really understand how you would use it to run a Dynamo node across multiple files:

  • How do you make a node use the document you feed it instead of the current document?
  • Or how can you change documents and point Dynamo to it? (If you change focus to a different file with Dynamo open it clams up and says "Dynamo is not pointing to the current document". Clicking in the workspace changes focus but is there a node to do that?)
This post started with an earlier version of Dynamo, does 0.91 makes any difference?

Dynamo now takes ages to load so having to close and open it to run one routine in multiple files has become very time consuming.

Hi Antohy,

That’s currently not possible out of the box. You’ll have to script that interaction yourself.

However Andreas Dieckmann made this wonderful package called “Dynamo Automation” that greatly simplifies the process of running a dynamo graph on multiple projects:

Not sure why 0.91 is taking so long to launch for you. I haven’t noticed any slowdowns on my side.


1 Like