Refering to a relative path

Hi there,

I would like to externalise my python scripts from my dynamo script, so I can work on the scripts seperately (via git).
Doing this is not a problem, what is a problem however is that I want to refer to the python scripts relatively to the dynamo script.

Is there a way to extract the path of the currently opened dynamo script?

I tried two options that kind of work (but really don’t):

  1. I use the dynamo log files to extract the path. However, this requires the dynamo file to be saved before it can be run.
  2. By using the “os.getcwd()” command. This only works if the open revit file is in the same directory as the dynamo file.

I would like to have a command that just returns the current working directory of the cynamo script.

Kind regards,

try the Graph.FilePath node from the SpringsUI package:


Thanks for your reply!
This works, however, I would like to do it without custom nodes and packages.
The idea is that when other people open the dynamo file, it always works and they don’t need any packages installed.
Is the code used in SpringsUI.Graph.FilePath open-source?

It will be when I get the chance to clean it up a bit and post it on GitHub. However you won’t be able to use it from python, because you need a hook to Dynamo’s view model. I don’t think there’s a straight-forward enough way to do that from python :frowning:

Alright, thanks a lot anyway!
Stubborn as I am, I’ll still have a look, but you’re probably right :wink:


Hi Dimitar! I need this function a lot, but the SpringsUI.Graph.FilePath isn´t working for me. Seems nothing happens when i choose the node in the dynamo UI (the node doesn´t appear on the workspace). Is it some bug? Im using Dynamo 2.0.1. I know that is an older post. Thanks in advance!

Hi, I haven’t ported the package to 2.0 but you can find all the source code here: