# Global variables vs. tags. in HomeyScript

**URL:** <https://community.homey.app/t/global-variables-vs-tags-in-homeyscript/91104>\
**Category:** Questions & Help\
**Tags:** homeyscript\
**Created:** [October 6, 2023, 11:07am UTC](https://community.homey.app/t/global-variables-vs-tags-in-homeyscript/91104 "2023-10-06T11:07:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Per\_Arne\_Slotte](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/per_arne_slotte/32/78879_2.png) [@Per\_Arne\_Slotte](https://community.homey.app/u/Per_Arne_Slotte)\
**Post date:** [October 6, 2023, 11:07am UTC](https://community.homey.app/t/global-variables-vs-tags-in-homeyscript/91104/1 "2023-10-06T11:07:59Z")

</div>

The documentation at [[Namespace: global - HomeyScript](https://athombv.github.io/com.athom.homeyscript/global)] is somewhat unclear regarding the persistence of **global variables** in HomeyScript.  
Regarding functions get() and set() it is stated:  
“Get a global value that’s accessible between HomeyScripts”  
while in the case of **tags** (function tag()) we have:  
Creates or updates a Flow Tag. These are persistent across reboots.  
Does this mean that global variables are not persistent across reboots?

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [October 6, 2023, 11:28am UTC](https://community.homey.app/t/global-variables-vs-tags-in-homeyscript/91104/2 "2023-10-06T11:28:03Z")

</div>

> [@Per\_Arne\_Slotte](#):
>
> Does this mean that global variables are not persistent across reboots?

That’s correct.

---

<div class="post-metadata">

**Author:** ![Per\_Arne\_Slotte](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/per_arne_slotte/32/78879_2.png) [@Per\_Arne\_Slotte](https://community.homey.app/u/Per_Arne_Slotte)\
**Post date:** [October 6, 2023, 12:01pm UTC](https://community.homey.app/t/global-variables-vs-tags-in-homeyscript/91104/3 "2023-10-06T12:01:14Z")

</div>

Thank you, I was afraid of that.  
It makes global variables less useful. My plan was to have one flow running once a day that calls a script that sets some variables, and another flow that runs each hour running a script that use these variables. That is not robust if the variables are not persistent. Have to find another, and more convoluted, solution then.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [October 6, 2023, 12:30pm UTC](https://community.homey.app/t/global-variables-vs-tags-in-homeyscript/91104/4 "2023-10-06T12:30:17Z")

</div>

You can make the first script set a flow tag, and use that flow tag as an argument for the other script.

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [October 6, 2023, 1:13pm UTC](https://community.homey.app/t/global-variables-vs-tags-in-homeyscript/91104/5 "2023-10-06T13:13:22Z")

</div>

> [@Per\_Arne\_Slotte](#):
>
> makes global variables less useful.

Instead of Global variables, you can use BeterLogic variables.
