index.html: script tag for import <script type="text/python" import="module_a" call="main_func"></script> module_a.py: Run code in the background thread import sys import plynth import plynth.js as js import requests def main_func(): button = js.document.getElementById("a_button") button.onclick = start_fetch @plynth.background def start_fetch(): r = requests.get("https://www.plynth.net/sample.jso