Each plant in plants.json names its controller make, and Python’s boiler/controllers/__init__.py turns that name into a module. Dev’s JavaScript digest still picks parsers from a manually maintained PARSERS table, so every new make means editing digest.js as well as adding a parser. You’ll let the make choose the module instead.
Build the Path From the Make
The Python loader builds a dotted name:
Language: Python
import importlib
def load_controller(make):
return importlib.import_module(f"{__name__}.{make}")
The import() that loaded the chart also takes any string, so a template literal does the same job. Save this as boiler/controllers/index.js:
Language: JavaScript
export async function loadController(make) {
return import(`./${make}.js`);
}