Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hook from module #136

Open
buganini opened this issue Apr 15, 2023 · 0 comments
Open

Add hook from module #136

buganini opened this issue Apr 15, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@buganini
Copy link

buganini commented Apr 15, 2023

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
@dkrystki dkrystki added the enhancement New feature or request label Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants