# Execute flow on startup before all others

**URL:** <https://discourse.nodered.org/t/execute-flow-on-startup-before-all-others/76925>\
**Category:** General\
**Created:** [25 March 2023 11:19 UTC](https://discourse.nodered.org/t/execute-flow-on-startup-before-all-others/76925 "2023-03-25T11:19:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DOSprojects](https://avatars.discourse-cdn.com/v4/letter/d/977dab/32.png) [@DOSprojects](https://discourse.nodered.org/u/DOSprojects)\
**Post date:** [25 March 2023 11:19 UTC](https://discourse.nodered.org/t/execute-flow-on-startup-before-all-others/76925/1 "2023-03-25T11:19:15Z")

</div>

Hi  
Is it possible to execute (and terminate) a flow before all others. For sure we can play with time-out in inject nodes, but that's error prone.

Use case: initialise some global variables/settings at startup to be reused in all other flows.

Thx

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [25 March 2023 11:25 UTC](https://discourse.nodered.org/t/execute-flow-on-startup-before-all-others/76925/2 "2023-03-25T11:25:21Z")

</div>

This way

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/c/dc1e1d03f545ca99727576897669924d8f8186c6.png)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [25 March 2023 12:42 UTC](https://discourse.nodered.org/t/execute-flow-on-startup-before-all-others/76925/3 "2023-03-25T12:42:57Z")

</div>

If you have multiple editor tabs, the flow on the leftmost tab is executed first.

So if your leftmost tab has an inject node set to inject after 0 seconds, the flow it starts _should_ run first of all.  
I use the first tab to set global variables like this and it seems to work, but I don't know if NR is guaranteed run a flow to the end before moving to the next.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [25 March 2023 12:56 UTC](https://discourse.nodered.org/t/execute-flow-on-startup-before-all-others/76925/4 "2023-03-25T12:56:30Z")

</div>

> [@jbudd](#):
>
> I don't know if NR is guaranteed run a flow to the end before moving to the next.

I don't believe so. There is an exception for the first tab only as I understand it. So that you can get things to run first.

Generally, I believe things mostly run in the order that you added them to your flows. Though of course, there are lots of other influences as well.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [24 May 2023 12:57 UTC](https://discourse.nodered.org/t/execute-flow-on-startup-before-all-others/76925/5 "2023-05-24T12:57:14Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
