subDimension

loading Flask blueprints dynamically

I wanted to be able to add and load plug-ins for a new system I’m working on without knowing what they were called at development time.

Ultimately, I created a very basic skeleton for doing this here:

flask-blueprint-loader

I got a little help from a project that was doing something similar too.

Basically, it boils down to using the Python imp module, which ends up looking a little like this:

fp, pathname, description = imp.find_module('my_plugin', ['plugin-folder'])
print fp, pathname, description
mod = imp.load_module('my_plugin', fp, pathname, description)