The symptom “the result flickers and pops up for a second, then resets” almost always means one of two things: either the submit button (type=“submit”) by default submits the form and reloads the popup, or some unhandled exception occurs within the PyScript/script, which drops the execution context and the page simply returns to its original state.
In a typical web application, onsubmit=“return false” or event.preventDefault() in JavaScript are a lifesaver, but if you’re using PyScript in an extension context (which has its own security rules and popup lifecycle in Chromium), the standard form handler may fire before PyScript has a chance to intercept the event. Extension popups generally operate by their own rules: as soon as focus is lost or a submit event occurs without canceling the action, the window may simply close or reset the DOM state.