Poco. Couldn't execute custom function

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

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:

poco:init_server(15005)

update:

poco:server_loop()

In my test script I try to perform:

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

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