nanome.api.plugin module

class Plugin(name, description, tags=None, has_advanced=False, permissions=None, integrations=None, version=None)[source]

Bases: object

Process that connects to NTS, and allows a user to access a PluginInstance.

When plugin process is running, an entry is added to the Nanome Stacks Menu.

When a user activates a Plugin, this class creates a PluginInstance object connected to the user’s Nanome session.

static create_parser()[source]

Command Line Interface for Plugins.

Moved into, but there are plugins that retrieve parser from Plugin class. Leaving this here for backwards compatibility.

rtype: argsparser: args parser

custom_data = None

Name of plugin as shown in the Nanome Stacks menu.

plugin_id = -1
Function to call when the plugin is about to exit
Useful when using autoreload
Function to call before the plugin runs and tries to connect to NTS
Useful when using autoreload
run(host=None, port=None, key=None)[source]
Starts the plugin by connecting to the server specified.
If arguments (-a, -p) are given when starting plugin, host/port will be ignored.
Function will return only when plugin exits.
  • host (str) – NTS IP address if plugin started without -a option
  • port (int) – NTS port if plugin started without -p option
Store arbitrary data to send to plugin instances
Parameters:args (Anything serializable) – Variable length argument list
static set_maximum_processes_count(max_process_nb)[source]
Set plugin class to instantiate when a new session is connected
The plugin class should interact with or override functions in PluginInstance to interact with Nanome
Parameters:plugin_class (PluginInstance) – Plugin class to instantiate
classmethod setup(name, description, tags, has_advanced, plugin_class, host=None, port=None, key=None, permissions=None, integrations=None)[source]