# Any trick to get "local" variables for a flow?

**URL:** <https://community.homey.app/t/any-trick-to-get-local-variables-for-a-flow/104307>\
**Category:** Developers\
**Tags:** advancedflow\
**Created:** [February 18, 2024, 4:35pm UTC](https://community.homey.app/t/any-trick-to-get-local-variables-for-a-flow/104307 "2024-02-18T16:35:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vletroye](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/vletroye/32/101044_2.png) [@vletroye](https://community.homey.app/u/vletroye)\
**Post date:** [February 18, 2024, 4:35pm UTC](https://community.homey.app/t/any-trick-to-get-local-variables-for-a-flow/104307/1 "2024-02-18T16:35:58Z")

</div>

Hello,

As far as I got it properly, variables that are defined in flows are global (shared among all flows)  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/2/32d24e4b550e25ba724dfa8df539f963e1ab152e.png)

I tried to find information on this forum to create “local variables” for my flows, I.e.: variables which would not be shared across flows, but would be local to the flow where it has been created (but not “temporary variables” ! I want them to be permanent even across reboots).

Did I miss something or I can only do it with a HomeyScript that create a Flow Tag ? If not mistaking, Flow Tags are assumed to be local to their flow… (hence their name 🙂 ).

I am asking because I tried with the script here under, called from a card HomeScript, and I see that the tag created is visible in all my flows ☹

```auto
if (args[0] === '' || args[0] === undefined)
  throw new Error('you have to pass your variable name and its value. Ex.: myvar, 1000');

const args_element = args[0].split(',');

if (args_element.length == 2){
  const name = args_element[0];
  const value = args_element[1];

  if (value === 'null')
    await tag(name, null); // Delete
  else
    await tag(name, value); // Create
} 
else if (args_element.length == 1) {
  const name = args_element[0];
  await tag(name, null); // Delete
}
else
  throw new Error('you have to pass your variable name and its value. Ex.: myvar, 1000');

return true

```

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/9/d90abe7cc53a30d6ebd2796b079f48891b6d260a.png)

The purpose is to have the local variables created dynamically by any advanced flow instantiated from a “template”… (I.e.: I am more curious if it’s doable than stuck because I can’t do it)

Thx for any comment or advice.

V.

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [February 20, 2024, 7:32am UTC](https://community.homey.app/t/any-trick-to-get-local-variables-for-a-flow/104307/2 "2024-02-20T07:32:47Z")

</div>

Nope, there is no way to achieve what you want.  
You cannot create scoped variables that are boot-persistent.

---

<div class="post-metadata">

**Author:** ![vletroye](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/vletroye/32/101044_2.png) [@vletroye](https://community.homey.app/u/vletroye)\
**Post date:** [February 20, 2024, 6:22pm UTC](https://community.homey.app/t/any-trick-to-get-local-variables-for-a-flow/104307/3 "2024-02-20T18:22:56Z")

</div>

Thx for the feedback !

V.
