# Poco. Couldn't execute custom function

**URL:** <https://forum.defold.com/t/poco-couldnt-execute-custom-function/70723>\
**Category:** Questions\
**Created:** [April 15, 2022, 1:52pm UTC](https://forum.defold.com/t/poco-couldnt-execute-custom-function/70723 "2022-04-15T13:52:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aceton41k](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/aceton41k/32/26712_2.png) [@aceton41k](https://forum.defold.com/u/aceton41k)\
**Post date:** [April 15, 2022, 1:52pm UTC](https://forum.defold.com/t/poco-couldnt-execute-custom-function/70723/1 "2022-04-15T13:52:30Z")

</div>

Hello there.  
I’m trying to call custom function from .script file. This script runs at certain moment (match in game).  
I added custom function

```lua
poco:set_dispatch_fn("TestNewFunction", function(x, y, z)
            print("INSIDE NEW CLIENT TEST FUNCTION!", x, y, z)
            return {message= "" .. (x + y + z)}
         end)

```

I defined poco server library in methods: init, update  
init:

```lua
poco:init_server(15005)

```

update:

```lua
poco:server_loop()

```

In my test script I try to perform:

```lua
poco_match = StdPoco(addr=(address, 15005), device=None, use_airtest_input=False)
...
cbk = poco.agent.rpc.call("TestNewFunctionMatch", 1, 2, 3)
cbk.wait()
print("Execute: result: '%s'" % cbk.result)

```

But my script is freezing on line cbk.wait(). If I pause script in debug mode I see folowing line:  
safetcp.py:36

```lua
trunk = self.sock.recv(size)

```

If I’m placing poco server and function in main.gui\_script everything works and the function is being called well
