simvx.core.hot_reload

Hot-reload system – watch script files for changes and reload them live.

On file change: serialize node state -> importlib.reload(module) -> instantiate new class -> restore state. Non-serializable state is warned and skipped.

Public API: from simvx.core.hot_reload import HotReloadManager

mgr = HotReloadManager(tree)
mgr.watch("game.py")          # start watching a module file
mgr.poll()                    # call each frame (or on a timer)

Module Contents

Classes

HotReloadManager

Watches script files for changes and hot-reloads node classes.

Data

API

simvx.core.hot_reload.log

‘getLogger(…)’

simvx.core.hot_reload.__all__

[‘HotReloadManager’]

class simvx.core.hot_reload.HotReloadManager(tree: simvx.core.engine.SceneTree, poll_interval: float = 0.5)

Watches script files for changes and hot-reloads node classes.

Usage: mgr = HotReloadManager(tree) mgr.watch(“my_game.py”) # In your game loop: mgr.poll() # checks every poll_interval seconds

Initialization

watch(file_path: str) None

Start watching a Python file for changes.

Args: file_path: Path to a .py file. The corresponding module must be importable.

unwatch(file_path: str) None

Stop watching a file.

poll(dt: float = 0.0) list[str]

Check watched files for changes. Call each frame with delta time.

Returns: List of module names that were reloaded.

force_reload(module_name: str) bool

Force-reload a specific module by name.

Returns: True if reload succeeded, False otherwise.