# How to using environment variables in the subflow

**URL:** <https://discourse.nodered.org/t/how-to-using-environment-variables-in-the-subflow/28773>\
**Category:** General\
**Created:** [23 June 2020 04:02 UTC](https://discourse.nodered.org/t/how-to-using-environment-variables-in-the-subflow/28773 "2020-06-23T04:02:59Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)\
**Post date:** [23 June 2020 04:37 UTC](https://discourse.nodered.org/t/how-to-using-environment-variables-in-the-subflow/28773/2 "2020-06-23T04:37:17Z")

</div>

Hello,  
Two things:

- please read this [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506) and edit your code above accordingly so that other people can import it.

- secondly the right way is `var yourvar = env.get("yourvar");`. But as the environment variables in subflows are quite recent additions and the func-exec node you use hasn’t been updated in 1 1/2 years it could be that it doesn’t support it. Is there a reason you don’t use a combination of a normal function node and an exec node instead?

Johannes

---

_[View the full topic](https://discourse.nodered.org/t/how-to-using-environment-variables-in-the-subflow/28773)._
