How to call an RPC custom function inside another function (each in a different file)

Hey guys! How can I call an registered rpc function from another server script?

Example:

  1. RPC function declaration and register:
-- file1.lua

function get_value(_, _)
  return nk.json_encode({value = 42})
end

nk.register_rpc(get_value, "get_value")
  1. Call function inside another file
-- file2.lua

function custom_rpc_func(context, payload)
  ...
  local value = nk.json_decode("-- HERE someway call the function 'get_value' and get it's response --")
  ...
end

Hello @Firemanarg,

What is the error you’re getting? How are you importing the function from file1 into the code in file2?

I’m not getting any error. The point is that I don’t know how to call the function in another file :joy:

I haven’t found any example of this in documentation