# Are subflow environment variables global or local to the subflow?

**URL:** <https://discourse.nodered.org/t/are-subflow-environment-variables-global-or-local-to-the-subflow/82805>\
**Category:** General\
**Created:** [12 November 2023 21:09 UTC](https://discourse.nodered.org/t/are-subflow-environment-variables-global-or-local-to-the-subflow/82805 "2023-11-12T21:09:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [12 November 2023 21:09 UTC](https://discourse.nodered.org/t/are-subflow-environment-variables-global-or-local-to-the-subflow/82805/1 "2023-11-12T21:09:34Z")

</div>

If I use environment vars as subflow parameters, are the env vars global to the instance or just the subflow (or are they even global global!)

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

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 November 2023 21:12 UTC](https://discourse.nodered.org/t/are-subflow-environment-variables-global-or-local-to-the-subflow/82805/2 "2023-11-12T21:12:18Z")

</div>

They available only to the instance.

In other words, each instance of a subflow gets their own version/own value.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [12 November 2023 21:15 UTC](https://discourse.nodered.org/t/are-subflow-environment-variables-global-or-local-to-the-subflow/82805/3 "2023-11-12T21:15:26Z")

</div>

Well that's what I want so I can use nice names instead of unique ones 🙂  
But while I'm here - why are they called environment variables.

I'm a Windows person and I thought environment vars were global across all Windows programs

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [12 November 2023 21:18 UTC](https://discourse.nodered.org/t/are-subflow-environment-variables-global-or-local-to-the-subflow/82805/4 "2023-11-12T21:18:31Z")

</div>

> why are they called environment variables

Because we started with allowing flows to read globally set environment variables in the traditional sense.

We then thought it would be useful to set them 'locally' with a subflow... and then in a flow... and then in a group.. and here we are.

A key point was they are read-only values that are statically set and cannot be modified by the flow. So rather than introduce yet another term for them, it just made sense to carry through the env-var terminology.

---

<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:** [26 November 2023 21:18 UTC](https://discourse.nodered.org/t/are-subflow-environment-variables-global-or-local-to-the-subflow/82805/5 "2023-11-26T21:18:39Z")

</div>

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