No, it’s not possible. The smart app cannot “call” a function defined in another app or device. What may look like a function call, e.g. “myswitch.off()”, actually sends a command to the device, but since commands are asynchronous, it cannot return anything. There’s one exception to this rule: a child device can call a function defined in the parent app.