# Variables from/to subflow

**URL:** <https://discourse.nodered.org/t/variables-from-to-subflow/49368>\
**Category:** General\
**Created:** [5 August 2021 08:57 UTC](https://discourse.nodered.org/t/variables-from-to-subflow/49368 "2021-08-05T08:57:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![funhall](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/funhall/32/36062_2.png) [@funhall](https://discourse.nodered.org/u/funhall)\
**Post date:** [5 August 2021 08:57 UTC](https://discourse.nodered.org/t/variables-from-to-subflow/49368/1 "2021-08-05T08:57:03Z")

</div>

Hi out there.

I have a subflow where i get flow. variables from the parent flow.  
Then I set a variable that I also use in the parent flow. Do I have to use the $parent. in the name there also, or is it ONLY when I get the flow. variable from the parent flow, and not the other way arround?  
I use the flow.bestlap in the parent flow also.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/f/2f746ce17a26efdd6be62396285c2a242a9b4af5.png)

---

<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:** [5 August 2021 10:15 UTC](https://discourse.nodered.org/t/variables-from-to-subflow/49368/2 "2021-08-05T10:15:18Z")

</div>

You use `$parent` whenever accessing the parent flow context whether for get or set.

---

<div class="post-metadata">

**Author:** ![funhall](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/funhall/32/36062_2.png) [@funhall](https://discourse.nodered.org/u/funhall)\
**Post date:** [5 August 2021 10:19 UTC](https://discourse.nodered.org/t/variables-from-to-subflow/49368/3 "2021-08-05T10:19:30Z")

</div>

So everywhere in subflow where i need the flow. var outside also i use $parent.??

---

<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:** [4 October 2021 10:20 UTC](https://discourse.nodered.org/t/variables-from-to-subflow/49368/4 "2021-10-04T10:20:00Z")

</div>

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