# Get Current dynamo file path

**URL:** <https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521>\
**Category:** Uncategorized\
**Tags:** revit, dynamo\
**Created:** [July 28, 2017, 6:45am UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521 "2017-07-28T06:45:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris.malcolm](https://avatars.discourse-cdn.com/v4/letter/c/958977/32.png) [@chris.malcolm](https://forum.dynamobim.com/u/chris.malcolm)\
**Post date:** [July 28, 2017, 6:45am UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/1 "2017-07-28T06:45:31Z")

</div>

Hi I would like to get the current working dynamo dyn file path (via a native or python node). Is this possible? Thanks.

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [July 28, 2017, 1:39pm UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/2 "2017-07-28T13:39:53Z")

</div>

I tried a few weeks ago and couldn’t find anything. Maybe someone else will have better luck.

---

<div class="post-metadata">

**Author:** ![4bimfercesp](https://avatars.discourse-cdn.com/v4/letter/4/b782af/32.png) [@4bimfercesp](https://forum.dynamobim.com/u/4bimfercesp)\
**Post date:** [July 28, 2017, 4:46pm UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/3 "2017-07-28T16:46:41Z")

</div>

Just checking…you want the current dyn thats being run? I may be able to do this using python…i will post it later  
.

---

<div class="post-metadata">

**Author:** ![chris.malcolm](https://avatars.discourse-cdn.com/v4/letter/c/958977/32.png) [@chris.malcolm](https://forum.dynamobim.com/u/chris.malcolm)\
**Post date:** [July 28, 2017, 4:58pm UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/4 "2017-07-28T16:58:27Z")

</div>

yes exactly! my main reason is i usually write python in a seperate file, and the dynamo is just literally a python node that reads an external file. so it will be easier for me to package up the dyn and py file for other users if dyn can know where it lives.

---

<div class="post-metadata">

**Author:** ![4bimfercesp](https://avatars.discourse-cdn.com/v4/letter/4/b782af/32.png) [@4bimfercesp](https://forum.dynamobim.com/u/4bimfercesp)\
**Post date:** [July 28, 2017, 9:19pm UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/5 "2017-07-28T21:19:15Z")

</div>

Hi just tried some of my python codes regarding this subject but unfortunately its only returning revit filepath as python cannot get the dynamo process running as its an add on to revit. Sorry…there are other ways though i just checked in the forum and apparently using dynamo logs can do it but its not the best solution but useful. Check it out

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [July 28, 2017, 9:21pm UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/6 "2017-07-28T21:21:44Z")

</div>

That’s right, I forgot about the log files. They do work for pulling the “current” file but like @4bimfercesp said they’re unreliable. It works in a pinch though.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [July 28, 2017, 11:58pm UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/7 "2017-07-28T23:58:50Z")

</div>

The forum post in question:

[http://dynamobim.org/forums/topic/get-the-dynamo-file-path-or-name/](http://dynamobim.org/forums/topic/get-the-dynamo-file-path-or-name/)

---

<div class="post-metadata">

**Author:** ![chris.malcolm](https://avatars.discourse-cdn.com/v4/letter/c/958977/32.png) [@chris.malcolm](https://forum.dynamobim.com/u/chris.malcolm)\
**Post date:** [July 29, 2017, 6:48pm UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/8 "2017-07-29T18:48:26Z")

</div>

I saw this post. Unfortunately, I do not want the need to save the dyn file before checking the log, defeats the purpose of me trying to externalize a script, and use the dyn script to read that path relatively.

---

<div class="post-metadata">

**Author:** ![Brendan\_Cassidy](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/brendan_cassidy/32/7685_2.png) [@Brendan\_Cassidy](https://forum.dynamobim.com/u/Brendan_Cassidy)\
**Post date:** [July 29, 2017, 9:38pm UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/9 "2017-07-29T21:38:06Z")

</div>

Have a look at the dynamo API as there may be something there(i have not looked)?

[http://dynamods.github.io/DynamoAPI/](http://dynamods.github.io/DynamoAPI/)

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [July 30, 2017, 8:36pm UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/10 "2017-07-30T20:36:17Z")

</div>

Good idea @Brendan_Cassidy. Looks like this might do the trick:  
[http://dynamods.github.io/DynamoAPI/Dynamo\_Graph\_Workspaces/IWorkspaceModel/#properties](http://dynamods.github.io/DynamoAPI/Dynamo_Graph_Workspaces/IWorkspaceModel/#properties)

---

<div class="post-metadata">

**Author:** ![chris.malcolm](https://avatars.discourse-cdn.com/v4/letter/c/958977/32.png) [@chris.malcolm](https://forum.dynamobim.com/u/chris.malcolm)\
**Post date:** [July 31, 2017, 2:21am UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/11 "2017-07-31T02:21:09Z")

</div>

Oh seems interesting, in ironpython how would one add this api?

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [July 31, 2017, 5:25pm UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/12 "2017-07-31T17:25:41Z")

</div>

Good find @Brendan_Cassidy and @jacob.small!  
Any idea on how to add the necessary reference or library? I’m not sure how to call these members.

---

<div class="post-metadata">

**Author:** ![Brendan\_Cassidy](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/brendan_cassidy/32/7685_2.png) [@Brendan\_Cassidy](https://forum.dynamobim.com/u/Brendan_Cassidy)\
**Post date:** [August 1, 2017, 10:12am UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/13 "2017-08-01T10:12:55Z")

</div>

I am not sure and maybe someone else could help with that as i have not tried it yet.

My gut feeling is that you just either import then usual dynamo services etc into dynamo but if they do not include the right things you could import the dll’s into the python script.

---

<div class="post-metadata">

**Author:** ![chris.malcolm](https://avatars.discourse-cdn.com/v4/letter/c/958977/32.png) [@chris.malcolm](https://forum.dynamobim.com/u/chris.malcolm)\
**Post date:** [August 1, 2017, 4:48pm UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/14 "2017-08-01T16:48:30Z")

</div>

I am able to access these methods, but as their abstract classes. This is done as such

```
import clr
clr.AddReference("DynamoCore")

import Dynamo.Graph.Workspaces as dyn

OUT = dyn

```

Anyone know how to get the current Dynamo Workspace instance (WorkspaceModel Instance)

---

<div class="post-metadata">

**Author:** ![Daniel\_Woodcock1](https://avatars.discourse-cdn.com/v4/letter/d/58f4c7/32.png) [@Daniel\_Woodcock1](https://forum.dynamobim.com/u/Daniel_Woodcock1)\
**Post date:** [August 1, 2017, 5:17pm UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/15 "2017-08-01T17:17:32Z")

</div>

Yeah, I tried this already out of curiosity but I only get a ReflectedProperty as I drill down. For instance…

```
import clr
clr.AddReference('DynamoCore')
from Dynamo import *

model = Graph.Workspaces.WorkspaceModel

name = model.Name

OUT = name

```

gives…

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/1/91c135755495eefffcab9259479acaeabcd721ec.png)

The same with the following code…

```
import clr
clr.AddReference('DynamoCore')
from Dynamo import *

wkSpace = Models.DynamoModel.CurrentWorkspace

OUT = wkSpace

```

Not sure if there is actually a way to do it in the Python IDE (and definitely not how I was trying), but I don’t fully understand the Dynamo API, a bit of a black box for me. Perhaps @Andreas_Dieckmann @Konrad_K_Sobon or @Thomas_Mahon might have inkling.

Cheers,  
Dan

---

<div class="post-metadata">

**Author:** ![Thomas\_Mahon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thomas_mahon/32/64209_2.png) [@Thomas\_Mahon](https://forum.dynamobim.com/u/Thomas_Mahon)\
**Post date:** [August 4, 2017, 1:36pm UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/16 "2017-08-04T13:36:02Z")

</div>

Hi @Daniel_Woodcock1 I’ve not looked at the DynamoCore library in any detail tbh, however `WorkspaceModel` is an abstract class that cant be instantiated. Instead `WorkspaceInfo` should be used and instatianted through its default constructor to avoid the runtime output from the Python node.

That said, this class appears to return null regardless of which properties are accessed. I’m not sure if these methods are only available in the CLI. @Michael_Kirschner2 @Aparajit_Pratap can maybe shed some more light on this?

---

<div class="post-metadata">

**Author:** ![Andreas\_Dieckmann](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/andreas_dieckmann/32/365_2.png) [@Andreas\_Dieckmann](https://forum.dynamobim.com/u/Andreas_Dieckmann)\
**Post date:** [August 5, 2017, 4:45pm UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/17 "2017-08-05T16:45:31Z")

</div>

Fwiw I posted a feature request for this on GitHub a couple of weeks ago:

> <https://github.com/DynamoDS/Dynamo/issues/8011>

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [August 6, 2017, 2:21am UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/18 "2017-08-06T02:21:51Z")

</div>

The only way its possible right now is to save the graph and read the log as @Andreas_Dieckmann said in his post.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/c/7c7f9fd0d4baf959387c2c2039e83cd43298c5da.png)

---

<div class="post-metadata">

**Author:** ![Haley\_Jovi\_Cazarini](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/haley_jovi_cazarini/32/30683_2.png) [@Haley\_Jovi\_Cazarini](https://forum.dynamobim.com/u/Haley_Jovi_Cazarini)\
**Post date:** [August 17, 2017, 2:54pm UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/19 "2017-08-17T14:54:57Z")

</div>

Hi @Kulkul,

I have replicated @Andreas_Dieckmann’s Python script but I am obtaining an error in line 22. As I do not know Python, I am unable to fix or understand the issue. Could you please help me with that?

I also wanted to add the full file path location to be extracted, but, again, my knowledge of Python is very limited. Could you please help me out modifying the attached file pointing out the changes to me?

I thank you beforehand for your help and attention.

Kind regards, Haley

 ![Andreas Dieckmann_Python-Current-Dynamo-File-Path](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/a/3adbc9ae2ffb6b73b864f90aa8979318887714e0.PNG)

 ![Andreas Dieckmann_Python-Current-Dynamo-File-Path_B](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/e/beed64779796b069870b5001432224790dd62708.PNG)

[GetCurrentDynamoFilePath.dyn](https://forum.dynamobim.com/uploads/short-url/37vBRN6f9jxgA2t6OdofocBiQNb.dyn) (11.9 KB)

---

<div class="post-metadata">

**Author:** ![4bimfercesp](https://avatars.discourse-cdn.com/v4/letter/4/b782af/32.png) [@4bimfercesp](https://forum.dynamobim.com/u/4bimfercesp)\
**Post date:** [August 17, 2017, 3:22pm UTC](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521/20 "2017-08-17T15:22:38Z")

</div>

Hi Haley…

Hows things?

I think you have extra parenthesis on line 22

latest\_file = max((all\_log\_files), key=os.path.getctime)

On @Kulkul screen shot its only

latest\_file = max(all\_log\_files, key=os.path.getctime)

have you tried that already?

[Next page](https://forum.dynamobim.com/t/get-current-dynamo-file-path/13521.md?page=2)
