# Self calls don't work in custom functions (SOLVED)

**URL:** <https://forum.defold.com/t/self-calls-dont-work-in-custom-functions-solved/36196>\
**Category:** Questions\
**Created:** [November 29, 2018, 3:23am UTC](https://forum.defold.com/t/self-calls-dont-work-in-custom-functions-solved/36196 "2018-11-29T03:23:09Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![ross.grams](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/r/cab0a1/32.png) [@ross.grams](https://forum.defold.com/u/ross.grams)\
**Post date:** [November 29, 2018, 4:18am UTC](https://forum.defold.com/t/self-calls-dont-work-in-custom-functions-solved/36196/4 "2018-11-29T04:18:52Z")

</div>

What `factory.create` returns is not a reference, it is just the hashed ID of the new object. Basically just its name. You can’t use that as `self`. Are you used to using another game engine? With Defold you generally don’t call functions on game objects. If you want to communicate between objects you use [message passing](https://www.defold.com/manuals/message-passing/). Or, if you just need to transfer data you can use [`go.get`](https://www.defold.com/ref/go/#go.get:url-property) and [`go.set`](https://www.defold.com/ref/go/#go.set:url-property-value) with script properties, though the data types you can use with [script properties](https://www.defold.com/manuals/script-properties/#_defining_a_script_property) are limited. Another option is to use a lua module with a lookup table or whatever (you can use a hashed ID as a table key for example).

There was [another thread here](https://forum.defold.com/t/set-constant-on-go-created-by-factory/35850) recently about setting and getting stuff from factory-created objects.

Also, it’s generally a bad idea to define global functions (any custom function you define without the `local` keyword is global). It’s better to put things like that in a module. It’s way too easy to forget that you defined that name globally and cause yourself all sorts of weird bugs and headaches. A bit more about that in [this thread](https://forum.defold.com/t/how-to-create-and-use-global-constants-solved/34536).

---

_[View the full topic](https://forum.defold.com/t/self-calls-dont-work-in-custom-functions-solved/36196)._
