Is there a way to reload Brython within the page ? #2187
-
Hi everyone, Brython load trough <body onload="brython()"> Is there a anyway to trigger a reload ? even with JS 🤮 ? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
from Brython window.brython() works, but when call once more the SCRIPT call with <script type="text/python" src="/aBrythonFile.bry"></script> are loaded twice, and if |
Beta Was this translation helpful? Give feedback.
-
Hi, You can specify the scripts that you want to "reload" by specifying a key "ids" in the call to <script type="text/python">
from browser import bind, window
print('main script')
@bind('#test', 'click')
def test(ev):
window.brython({'ids': ['reload']}) # only run the script with id "reload"
</script>
<script type="text/python" id="reload">
print('reload')
</script>
<button id="test">reload script</button> |
Beta Was this translation helpful? Give feedback.
-
Decorators have been supported almost from the beginning of Brython ;-) The |
Beta Was this translation helpful? Give feedback.
Hi,
You can specify the scripts that you want to "reload" by specifying a key "ids" in the call to
brython()
: