Rearranged self.plugin documentation

This commit is contained in:
Joel Collins 2019-01-29 14:49:04 +00:00
parent 397395f05f
commit 54106e845f
2 changed files with 14 additions and 12 deletions

View file

@ -65,6 +65,20 @@ For example:
this_object = object_dictionary[object_id]
...
Calling plugin methods from routes
++++++++++++++++++++++++++++++++++
Instances of MicroscopeViewPlugin have direct access to their associated microscope plugin methods, without needing to know the plugin namespace in advance. As described earlier in this section, all plugins get attached to the microscope in their own namespace, based on the plugins name. This means there are two equivalent ways to access your plugin methods from a web API plugin:
.. code-block:: python
...
# Call a method from our plugin, using the MicroscopeViewPlugin.plugin shortcut
self.plugin.my_plugin_method()
# Call a method from our plugin, using the full route
self.microscope.my_plugin_name.my_plugin_method()
...
Building responses
++++++++++++++++++