lektor-website/content/docs/api/plugins/get-plugin/contents.lr

26 lines
544 B
Plaintext
Raw Normal View History

2015-12-19 14:52:17 +01:00
title: get_plugin
---
summary: Look up a plugin instance.
---
type: function
---
signature: plugin_id_or_class, env=None
---
module: lektor.pluginsystem
---
body:
This function can look up a plugin instance for an environment by plugin ID
or plugin class. This is particularly useful to retrieve state from a plugin.
If the `env` is not given a context needs to be active and the env of the
context is used.
## Example
```python
from lektor.pluginsystem import get_plugin
plugin = get_plugin('the-plugin-id')
cfg = plugin.get_config()
```