# Access sub flow variables in a module

**URL:** <https://discourse.nodered.org/t/access-sub-flow-variables-in-a-module/48677>\
**Category:** General\
**Created:** [20 July 2021 21:58 UTC](https://discourse.nodered.org/t/access-sub-flow-variables-in-a-module/48677 "2021-07-20T21:58:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [20 July 2021 21:58 UTC](https://discourse.nodered.org/t/access-sub-flow-variables-in-a-module/48677/1 "2021-07-20T21:58:36Z")

</div>

As the title states.

A Z-Wave node, I am the author of, can act differently if added to a sub flow.  
This however, needs variables added to the sub flow (which is easy enough).

But how on earth, do I access those variables inside a module? (as apposed to a function node)

I see there is a private api the function node uses `node._flow.getSetting("Name"),` But I dont want to start hacking away at private API's

---

<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:** [20 July 2021 22:26 UTC](https://discourse.nodered.org/t/access-sub-flow-variables-in-a-module/48677/2 "2021-07-20T22:26:08Z")

</div>

We really should provide a more direct api that doesn't involve you needing to know about `_flow`.

A possibly 'safer' alternative is:

```auto
RED.util.evaluateNodeProperty("Name", "env", node);

```

This is the api you'd use if you have a TypedInput in your node UI that included the 'env' type.

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [20 July 2021 22:30 UTC](https://discourse.nodered.org/t/access-sub-flow-variables-in-a-module/48677/3 "2021-07-20T22:30:02Z")

</div>

Worked perfectly!  
thank you.

I'm pretty sure I have seen `evaluateNodeProperty` in places - but didn't know its use is for this kind of thing. - again thanks

---

<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:** [3 August 2021 22:31 UTC](https://discourse.nodered.org/t/access-sub-flow-variables-in-a-module/48677/4 "2021-08-03T22:31:03Z")

</div>

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