Skip to content
Ben edited this page Aug 8, 2016 · 4 revisions

Calling a Remote Function

To call a remote function you use the plug-ins run method. Let's call the "add function" we registered earlier:

# ... make sure plug-in is registered and connected!
result = plug.run("<plugin_id>", "add", [5,11])

try:
  res = result.get_result() # blocking by default
except RemoteError:
  # ..
  pass

assert(res[0] == 16)

The format of the result is defined by the author of the corresponding plug-in, but always in a list. Make sure you read and understand their specifications.

If anything goes wrong during the execution a RemoteError is raised.

The Result class has some methods you should check out.

Note: Run calls are asynchronous by default!

Clone this wiki locally