## My first plugin in Python

Python is a great language to quickly develop extensions for an Ethos enabled applications. It is so simple in fact, that it is probably easiest to learn by example.

Just like plugins in C, we need a plugin description file for our plugin. In addition to the plugin description file, we need to add a python module that implements our plugin. First off, lets look at the python code required.

    # sample.py
    import ethos

    class SamplePlugin(ethos.Plugin):
        def activate(self):
            print 'Sample plugin activated'
        def deactivate(self):
            print 'Sample plugin deactivated'

As you can see from the example, we simply need to import the ethos python module and inherit from the ethos.Plugin class. When your plugin is activated, it will be created by the plugin engine on demand and the ethos.Plugin.activate() method is called.

The plugin description files look the same as for C except for that you need to set Loader option. Below is an example plugin description file for the sample python module above.

    [Example Plugin]
    Name=Sample
    Description=A sample python plugin
    Module=sample
    Loader=python
    Authors=John Doe
    Copyright=Public Domain
    IAage=1

You should replace "Example" with the name of the application you are trying to extend.

Both of these files, sample.example-plugin and sample.py should be placed within the plugin directory for your target application.