# Go.get\_id() is not functional because the engine thinks im not using a script file

**URL:** <https://forum.defold.com/t/go-get-id-is-not-functional-because-the-engine-thinks-im-not-using-a-script-file/70686>\
**Category:** Bugs\
**Created:** [April 7, 2022, 8:31am UTC](https://forum.defold.com/t/go-get-id-is-not-functional-because-the-engine-thinks-im-not-using-a-script-file/70686 "2022-04-07T08:31:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stale](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/stale/32/32618_2.png) [@Stale](https://forum.defold.com/u/Stale)\
**Post date:** [April 7, 2022, 8:31am UTC](https://forum.defold.com/t/go-get-id-is-not-functional-because-the-engine-thinks-im-not-using-a-script-file/70686/1 "2022-04-07T08:31:42Z")

</div>

**Describe the bug (REQUIRED)**  
the go.get\_id() is non-functional because it believes I’m not using a script instance (I am)  
**To Reproduce (REQUIRED)**  
I opened a script file and just attempted both local var=go.get\_id() and print(go.get\_id()) both  
failed because of the error I shown

**Expected behaviour (REQUIRED)**  
just being able to use go.get\_id() properly by either storing it to a variable or using it directly

**Defold version (REQUIRED):**  
1.3.1 but I’ve had this problem in previous versions

**Platforms (REQUIRED):**  
hp laptop  
windows 10

**Additional context (OPTIONAL):**  
weirdly I had a simmilar issue with gui.get\_node not liking being saved to a variable however  
I realised I still could input it raw (gui.play\_flipbook(gui.get\_node(“portrait two”),“dante\_hooded”)), this is not possible with get\_id()

**Screenshot**  
[https://www.reddit.com/user/maybehollow/comments/ty8ba6/bug\_for\_defold\_engine/?utm\_source=share&utm\_medium=web2x&context=3](https://www.reddit.com/user/maybehollow/comments/ty8ba6/bug_for_defold_engine/?utm_source=share&utm_medium=web2x&context=3)

---

<div class="post-metadata">

**Author:** ![Dzuvan](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dzuvan/32/11275_2.png) [@Dzuvan](https://forum.defold.com/u/Dzuvan)\
**Post date:** [April 7, 2022, 8:35am UTC](https://forum.defold.com/t/go-get-id-is-not-functional-because-the-engine-thinks-im-not-using-a-script-file/70686/2 "2022-04-07T08:35:40Z")

</div>

Move the get\_id in a lifecycle function like init and it will work. Issue is not that it’s being saved into variable, but that variable is outside of lifecycle / function.

---

<div class="post-metadata">

**Author:** ![Klear](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/klear/32/11577_2.png) [@Klear](https://forum.defold.com/u/Klear)\
**Post date:** [April 7, 2022, 8:38am UTC](https://forum.defold.com/t/go-get-id-is-not-functional-because-the-engine-thinks-im-not-using-a-script-file/70686/3 "2022-04-07T08:38:30Z")

</div>

To add to the answer, if you want to store this in a variable local to the script, you can do:

```
local var

function init(self)
    var = go.get_id()
end

```

---

<div class="post-metadata">

**Author:** ![Stale](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/stale/32/32618_2.png) [@Stale](https://forum.defold.com/u/Stale)\
**Post date:** [July 12, 2022, 11:21am UTC](https://forum.defold.com/t/go-get-id-is-not-functional-because-the-engine-thinks-im-not-using-a-script-file/70686/4 "2022-07-12T11:21:34Z")

</div>

I just moved it all to a newly made script file and deleted the previous and it worked
