From 34535bcbffd5506faeaba7c8ada546e29f00c7eb Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Thu, 4 Jan 2024 13:08:14 +0100 Subject: [PATCH] custom_extra_functionality: assume same function name as file name --- scripts/solve_network.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index 4b988666..203d8b0f 100644 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -835,7 +835,8 @@ def extra_functionality(n, snapshots): sys.path.append(os.path.dirname(source_path)) module_name = os.path.splitext(os.path.basename(source_path))[0] module = importlib.import_module(module_name) - module.custom_extra_functionality(n, snapshots, snakemake) + custom_extra_functionality = getattr(module, module_name) + custom_extra_functionality(n, snapshots, snakemake) def solve_network(n, config, solving, opts="", **kwargs):