Go.get_id() is not functional because the engine thinks im not using a script file

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()


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.


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()

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