Skip to content

Commit c12d2b9

Browse files
committed
Fixed a loading bug
1 parent 667bb29 commit c12d2b9

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

ngcsimlib/_src/context/context.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -344,15 +344,12 @@ def load(directory: str, module_name: str):
344344
with open(f"{path}/connections.json", "r") as fp:
345345
connectionData = json.load(fp)
346346
for connectionRoot, target in connectionData.items():
347-
context_path = ctx.path.split(":")
348-
compartment_path = connectionRoot.split(":")
349-
component_name = compartment_path[len(context_path)]
350-
component = ctx.get_components(component_name, unwrap=True)
351-
if hasattr(component, compartment_path[-1]) and isinstance(getattr(component, compartment_path[-1]), Compartment):
352-
if isinstance(target, str):
353-
getattr(component, compartment_path[-1]).target = target
354-
else:
355-
getattr(component, compartment_path[-1]).target = BaseOp.load_op(target)
347+
dest = global_state_manager.get_compartment(connectionRoot)
348+
if isinstance(target, str):
349+
dest.target = target
350+
else:
351+
dest.target = BaseOp.load_op(target)
352+
356353

357354
return ctx
358355

0 commit comments

Comments
 (0)