Step 9: Edit __init__.py
This file initializes the plugin's package.
Explanation
The __init__.py
file is needed for Python to identify a directory as a
package (or subpackage). It also allows defining "shortcuts" for importing
from your package. You can read more about the __init__.py
file
here.
In our case, we simply import the initializer
object that we defined in
plugin_initializer.py
. This allows import statements to be shorter:
# Without initializer imported in __init__.py
from parsomics_plugin_interpro.plugin_initializer import initializer
# With initializer imported in __init__.py
from parsomics_plugin_interpro import initializer
Hands on
- The template most likely generated the entire file correctly. It is also already committed.
Result
plugin_initializer.py
from .plugin_initializer import initializer