# Connection Extension / BaseModule

If you plan to write a general communication protocol integration then this is the correct page for you.

The **`sp.BaseModule`** supports [events](/grid/extensions/events.md) as well as [actions](/grid/extensions/actions.md).\
\- Receive commands and/or data within Grid.\
\- Send commands and/or data from Grid.\
\- Supports user data

{% hint style="danger" %}
If you plan to develop a device/endpoint specific implementation, please see [sp.BaseDevice](broken://pages/gOjzf4rTzjIomarpG4Eq)
{% endhint %}

## Sample

This are the minimum requirements to register a plugin:

```python
import sp

class IO_Plugin(sp.BaseModule):

    pluginInfo = {}

    def __init__(self):
        sp.BaseModule.__init__(self)

if __name__ == "__main__":
	sp.registerPlugin(IO_Plugin)
```

<figure><img src="/files/Cq3i5ayOTqoLLQ9Req0A" alt=""><figcaption><p>This is how it will look within the Project Tree,<br>if not modified with the pluginInfo parameter</p></figcaption></figure>

<figure><img src="/files/uShiT7JbRdjV4NaJUBN2" alt=""><figcaption><p>This is how it will look within the Inspector when not modified with the pluginInfo parameter</p></figcaption></figure>

## Main Class

The class name <mark style="color:orange;">**`IO_Plugin`**</mark> can be customized and should be unique.

```python
class IO_Plugin(sp.BaseModule):
```

While **`sp.BaseModule`** can´t be renamed.&#x20;

{% hint style="warning" %}
When a class name is already been use, you will get a notification within the log like this:\
\&#xNAN;*`BaseObject IO_Plugin already existing, overwriting with new one.`*\
\
**You need to have** [**Project loading logging**](broken://pages/C7rqVqmAt0GHDweiGNW9) **enabled to see this kind of messages.**
{% endhint %}

## Plugin Info

Each plugin needs a `pluginInfo` parameter.\
Within this you can define Icons, search Keywords, custom object names and much more.\
For more information see [here](#plugin-info).

## Initialization

Within your **Main Class** it´s necessary to define a function for the initialization:

```python
    def __init__(self):
        sp.BaseModule.__init__(self)
```

## Register

To register the plugin you need the following lines of code outside of your **Main Class**:

```python
if __name__ == "__main__":
	sp.registerPlugin(IO_Plugin)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://stage-precision.gitbook.io/grid/extensions/extension-types/connection-extension-basemodule.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
