Skip to main content
This page covers middleware.py dependency imports, system utility functions, runtime scheduled commands, and group management methods. Public plugins should prefer the functions listed here and avoid relying on unpublished internal actions.

import_module(module, package="", version="", manager="")

Ensure a Python dependency is available, then return the imported module object.
str
required
Module name passed to importlib.import_module(...).
str
Real package name. Use it when the package name differs from the import name, such as importing PIL.Image from the pillow package.
str
Required version.
str
Package manager name. Python dependencies usually use pip; omit it to let the runtime infer the manager.
The current SDK also keeps importModule = import_module as a compatibility alias. New Python plugins should use import_module(...).
Prefer declaring fixed dependencies in the manifest dependency field. Use import_module(...) for on-demand loading, dynamic versions, or old plugin compatibility. Do not call it repeatedly in hot loops.

System and utility functions

The SDK keeps defaults like imtypes=[] for compatibility. In your own Python functions, prefer None as the default to avoid mutable default argument issues.

Cron

Cron manages runtime scheduled commands. It is different from manifest cron: manifest cron triggers the current plugin, while the Cron class adds, updates, lists, and deletes runtime scheduled commands.
Current Python addCron(...) / updateCron(...) do not require every positional parameter. The method omits fields whose value is None. To clear a field, pass an empty string "".

Group management

These methods depend on current IM adapter support. Unsupported adapters may return errors or have no effect. They return the runtime data value directly.

Next steps

Last modified on June 3, 2026