Skip to content

Is there a way to reload Brython within the page ? #2187

Discussion options

You must be logged in to vote

Hi,

You can specify the scripts that you want to "reload" by specifying a key "ids" in the call to brython():

<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>

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@BobSquarePants
Comment options

@BobSquarePants
Comment options

Answer selected by BobSquarePants
Comment options

You must be logged in to vote
4 replies
@BobSquarePants
Comment options

@BobSquarePants
Comment options

@PierreQuentel
Comment options

@BobSquarePants
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants