reloadware/reloadium

Add hook from module

buganini opened this issue · 0 comments

I'd like to trigger specific action after reload, the hook works in the main file but not in the module
https://github.com/buganini/PUI/blob/main/examples/generic_hotreload.py#L22

Is there a way to register hook from a module? If comment is not available in module, maybe an empty decorator function with special name? like

try:
    def reloadium__after_reload(f):
        return f

    @reloadium__after_reload
    def after_reload(actions):
        PUIView.reload()

except:
    pass

or just

try:
    import reloadium
    reloadium.register_after_reload(lambda actions: PUIView.reload())
except:
    pass