# Calling script from within script

**URL:** <https://community.homey.app/t/calling-script-from-within-script/89932>\
**Category:** Questions & Help\
**Created:** [September 21, 2023, 10:00pm UTC](https://community.homey.app/t/calling-script-from-within-script/89932 "2023-09-21T22:00:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheKos](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/thekos/32/33969_2.png) [@TheKos](https://community.homey.app/u/TheKos)\
**Post date:** [September 21, 2023, 10:00pm UTC](https://community.homey.app/t/calling-script-from-within-script/89932/1 "2023-09-21T22:00:13Z")

</div>

I want to call a script from wihtin another script.  
I tried this, no errors but also the script called is not executed. I can’t figure out what’s wrong with the code.

let HomeyScript= await Homey.apps.getApp({id:“com.athom.homeyscript/”});  
HomeyScript.apiPost({script:“reset-testvars/run”});

I also need to pass some parameters, but tried the simple version first.  
Tried several variations on the syntax, but no luck. What am I missing ?  
Any help appreciated.  
Thanks Theo

---

<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:** [September 23, 2023, 3:33pm UTC](https://community.homey.app/t/calling-script-from-within-script/89932/2 "2023-09-23T15:33:48Z")

</div>

I think HomeyScript does not have permission for HomeyScript? (This would be true by default).

However, you can execute a HomeyScript flowcard with the correct arguments: homey.flows.runFlowcard (or something like that 😉 )

---

<div class="post-metadata">

**Author:** ![Rupert\_Rieger](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rupert_rieger/32/81523_2.png) [@Rupert\_Rieger](https://community.homey.app/u/Rupert_Rieger)\
**Post date:** [April 23, 2024, 11:13am UTC](https://community.homey.app/t/calling-script-from-within-script/89932/3 "2024-04-23T11:13:31Z")

</div>

> [@TheKos](#):
>
> et HomeyScript= await Homey.apps.getApp({id:“com.athom.homeyscript/”});  
> HomeyScript.apiPost({script:“reset-testvars/run”});

Has anyone an idea who this could work???

---

<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:** [April 23, 2024, 3:51pm UTC](https://community.homey.app/t/calling-script-from-within-script/89932/4 "2024-04-23T15:51:49Z")

</div>

> [@How to run Homeyscript from an Advanced Flow with Args\[\]](https://community.homey.app/t/how-to-run-homeyscript-from-an-advanced-flow-with-args/107176/5):
>
> No.

---

<div class="post-metadata">

**Author:** ![Rupert\_Rieger](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rupert_rieger/32/81523_2.png) [@Rupert\_Rieger](https://community.homey.app/u/Rupert_Rieger)\
**Post date:** [April 24, 2024, 10:11am UTC](https://community.homey.app/t/calling-script-from-within-script/89932/5 "2024-04-24T10:11:29Z")

</div>

Can you explain me, how i get the id of an script?

---

<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:** [April 24, 2024, 10:20am UTC](https://community.homey.app/t/calling-script-from-within-script/89932/6 "2024-04-24T10:20:54Z")

</div>

Open the list of scripts on [https://my.homey.app](https://my.homey.app), open your browser’s developer console, open the “Network” tag, reload the page, then look at the response for the request to `/api/app/com.athom.homeyscript/script`

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/4/44bd83b1a8e8d1607a26b2bbaa9bff34b53414f9.png)
