Skip to content
Snippets Groups Projects
Commit 82e398a7 authored by Sebastian Steinlechner's avatar Sebastian Steinlechner Committed by Jameson Rollins
Browse files

allow relative imports for budgets

Budget import mechanism in load_budget currently doesn't allow for importing from sub-modules.  This fixes that issue.

closes #62
parent 1352253c
No related branches found
No related tags found
No related merge requests found
from __future__ import division
import os
import sys
import logging
import importlib
import numpy as np
......@@ -22,6 +23,7 @@ def _load_module(name_or_path):
path = os.path.join(path, '__init__.py')
spec = importlib.util.spec_from_file_location(modname, path)
mod = importlib.util.module_from_spec(spec)
sys.modules[mod.__name__] = mod
spec.loader.exec_module(mod)
else:
mod = importlib.import_module(name_or_path)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment