# Detect if running inside Dynamo Player

**URL:** <https://forum.dynamobim.com/t/detect-if-running-inside-dynamo-player/80340>\
**Category:** Developers\
**Tags:** dynamo\
**Created:** [August 25, 2022, 5:40pm UTC](https://forum.dynamobim.com/t/detect-if-running-inside-dynamo-player/80340 "2022-08-25T17:40:28Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![teocomi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/teocomi/32/10671_2.png) [@teocomi](https://forum.dynamobim.com/u/teocomi)\
**Post date:** [August 25, 2022, 5:40pm UTC](https://forum.dynamobim.com/t/detect-if-running-inside-dynamo-player/80340/1 "2022-08-25T17:40:28Z")

</div>

Our [Speckle](https://speckle.systems/) Dynamo plugin requires the user to click a button to work, but some folks are asking to be able to run it from Dynamo Player as well.

Is there a way we can detect from [our C# node](https://github.com/specklesystems/speckle-sharp/blob/main/ConnectorDynamo/ConnectorDynamo/ReceiveNode/Receive.cs) if the node is running from Dynamo Player or from the Dynamo UI?

If so we’d be able to automatically “Receive” without user input.  
Note: the auto receive option is only triggered when changes are detected in the Speckle stream, so not valid for this use case.

![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/a/9a19e1de8d66079ba1163da20fdc32cc9cef6bb0.gif)

---

<div class="post-metadata">

**Author:** ![solamour](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/solamour/32/153516_2.png) [@solamour](https://forum.dynamobim.com/u/solamour)\
**Post date:** [August 25, 2022, 6:00pm UTC](https://forum.dynamobim.com/t/detect-if-running-inside-dynamo-player/80340/2 "2022-08-25T18:00:21Z")

</div>

Hi @teocomi, long time no chat! @Michael_Kirschner2 is asking the Player team now and will get back to you 🙌

---

<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:** [August 25, 2022, 6:31pm UTC](https://forum.dynamobim.com/t/detect-if-running-inside-dynamo-player/80340/3 "2022-08-25T18:31:42Z")

</div>

I’m actually the one who most recently brought this up on the Speckle forums. I don’t know if it would be the same fix, but we’d also want this to work when running in GD as well. Potentially with the use of the Gate node if possible. This goes for both sending and receiving.

---

<div class="post-metadata">

**Author:** ![solamour](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/solamour/32/153516_2.png) [@solamour](https://forum.dynamobim.com/u/solamour)\
**Post date:** [August 25, 2022, 7:32pm UTC](https://forum.dynamobim.com/t/detect-if-running-inside-dynamo-player/80340/4 "2022-08-25T19:32:55Z")

</div>

FYI @craig.long @LilliSmith

---

<div class="post-metadata">

**Author:** ![teocomi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/teocomi/32/10671_2.png) [@teocomi](https://forum.dynamobim.com/u/teocomi)\
**Post date:** [August 25, 2022, 9:25pm UTC](https://forum.dynamobim.com/t/detect-if-running-inside-dynamo-player/80340/5 "2022-08-25T21:25:47Z")

</div>

Thanks @solamour !  
Grat to be hanging here again 😃

---

<div class="post-metadata">

**Author:** ![Michael\_Kirschner2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/michael_kirschner2/32/75576_2.png) [@Michael\_Kirschner2](https://forum.dynamobim.com/u/Michael_Kirschner2)\
**Post date:** [August 25, 2022, 9:59pm UTC](https://forum.dynamobim.com/t/detect-if-running-inside-dynamo-player/80340/6 "2022-08-25T21:59:11Z")

</div>

I’m not sure there is a great solution - but I can think of funny brittle workarounds, so I’ll share them down with the disclaimer that they are not suggestions from the player team, just my rambling.

1. walk the stack to see who called run - is it the player? ["Stack Walking" in the .NET Runtime · Performance is a Feature!](https://mattwarren.org/2019/01/21/Stackwalking-in-the-.NET-Runtime/)
2. check if a particular module is loaded, if it is maybe GD or Player is active - this will probably not work.
3. check if the DynamoView is visible, if it is, you’re probably not in Player or GD.
4. check the current executing application location -

combining all of these you could probably make a pretty good guess, though it seems like a useful API and should be added to core.

---

<div class="post-metadata">

**Author:** ![Bzz](https://avatars.discourse-cdn.com/v4/letter/b/eada6e/32.png) [@Bzz](https://forum.dynamobim.com/u/Bzz)\
**Post date:** [August 26, 2022, 2:10pm UTC](https://forum.dynamobim.com/t/detect-if-running-inside-dynamo-player/80340/7 "2022-08-26T14:10:45Z")

</div>

@teocomi it is possible to identify the fact that the graph is running in headless mode.  
We added some new API some time ago DynamoModel.DynamoModelState so you can check for StartedUiless.  
In theory that could be some other Revit add-in that is executing the graph not necessarily DynamoPlayer. But maybe that’s even better ? If that’s not good enough “Stack Walking” should do it as Mike described above.

---

<div class="post-metadata">

**Author:** ![teocomi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/teocomi/32/10671_2.png) [@teocomi](https://forum.dynamobim.com/u/teocomi)\
**Post date:** [August 26, 2022, 6:07pm UTC](https://forum.dynamobim.com/t/detect-if-running-inside-dynamo-player/80340/8 "2022-08-26T18:07:41Z")

</div>

Sweet, `StartedUiless` is exactly what we need 🙂  
Thanks for the help!

Unfortunately it’s only available from Dynamo 2.13 onwards which I believe is only supported by Revit 2022 and up… So we might have to create a dedicated node just for this use case.

PS  
Is there an updated compatibility table like [this](https://primer.dynamobim.org/08_Dynamo-for-Revit/8-1_The-Revit-Connection.html)?

---

<div class="post-metadata">

**Author:** ![solamour](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/solamour/32/153516_2.png) [@solamour](https://forum.dynamobim.com/u/solamour)\
**Post date:** [August 26, 2022, 6:23pm UTC](https://forum.dynamobim.com/t/detect-if-running-inside-dynamo-player/80340/9 "2022-08-26T18:23:47Z")

</div>

@teocomi the Dynamo Primer has been updated here: [The Revit Connection - Dynamo](https://primer2.dynamobim.org/7_dynamo_for_revit/1-the-revit-connection)!

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [August 26, 2022, 7:04pm UTC](https://forum.dynamobim.com/t/detect-if-running-inside-dynamo-player/80340/10 "2022-08-26T19:04:52Z")

</div>

@teocomi FYI: Revit 2022.1.3 uses Dynamo 2.12.1. You need to use Revit 2023 to use Dynamo 2.13
