simvx.core.scene_io.loader

Runtime loading: import a scene .py file or folder and instantiate its primary Node.

load_scene is the canonical way to take a path on disk and return a live

class:

~simvx.core.Node tree. For editing the source, use

class:

SceneFile / :class:SceneModule; this module is the runtime side.

Module Contents

Functions

load_scene

Load a scene from a .py file or scene-module folder.

Data

API

simvx.core.scene_io.loader.__all__

[‘load_scene’]

simvx.core.scene_io.loader.load_scene(path: str | pathlib.Path) simvx.core.node.Node[source]

Load a scene from a .py file or scene-module folder.

File path → imports the module (under a unique synthetic name) and instantiates the primary :class:Node subclass. Folder path → imports the package via :func:importlib.import_module (after pinning path.parent onto :data:sys.path) and instantiates the primary class declared in __init__.py or, as a fallback, <folder>/<folder>.py.

In both cases :meth:ScriptManager.load_tree is run on the result so nodes carrying script references resolve relative to the project layout (project/scenes/foo.pyproject/ is the script root).