Skip to main content

Dynamically load other python modules to your project

Project description

Simple Python Plugin Loader

PyPI package PyPI version

This module provides a simple way to dynamically load other Python modules as Plugins to your current project.


You can install this python module via pip:

pip install simple-plugin-loader

Otherwise the module can be downloaded from PyPI:


  1. Import the module:
    from plugin_loader.loader import Loader
  2. Load your plugins/modules:
    # initialize the loader
    loader = Loader()
    # load your plugins
    plugins = self.loader.load_plugins(<plugin_path>, <plugin_base_class, <recursive>)
  3. (Optional) The already loaded plugins/modules can be accessed via the plugins property of the loader instance:
    plugins = loader.plugins

load_plugins(...) Method

  • <plugin_path>: str
    This string represents the path (relative or absolute) to the directory from where the plugins/modules should be loaded.
  • <plugin_base_class>: class (Default: SamplePlugin)
    The Loader does not load all found modules that are in the above directory. It only loads classes that are sub-classes of the here specified class.
    The default value of this argument is the SamplePlugin class. You can use this class as the base class for your plugins:
    from plugin_loader.sample_plugin import SamplePlugin
    class YourPlugin(SamplePlugin):
  • <recursive>: bool (Default: False)
    Set this flag to True if you wish to load plugins/modules recursively to the above directory.
Return value

The method returns a dictionary that has the following structure:

  • Key: The name of the plugin/module. This name is the module name of the module that contains the plugin class.
  • Value: The plugin class. Not an instance!

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for simple-plugin-loader, version 1.1
Filename, size File type Python version Upload date Hashes
Filename, size simple_plugin_loader-1.1-py3-none-any.whl (16.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size simple-plugin-loader-1.1.tar.gz (4.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page