'Run script python in web browser

I have a script python for Reading biometric identity card with a card reader this script use this https://github.com/roeften/pypassport, i want to creat a web app with django and use this script and run it on client machine (on web browser) , each user can read his card with a card reader on this web application. how can i do that ? any idea can be useful looked at this part of script that I want to run on the client browser:

from pypassport.reader import ReaderManager
from pypassport.reader import ReaderManager

from pypassport.epassport import EPassport, mrz
r = ReaderManager()
reader = r.waitForCard()
p = EPassport(reader,"YOURMRZINFO")
p.register(print)
p.setCSCADirectory("C:\\TEMP")
p.doBasicAccessControl()
p.doActiveAuthentication()

p['DG2']


Solution 1:[1]

if you want to run it in common browsers like "Chrome, Firefox, Opera, Edge ...", that's impossible. python must in python Virtual Machine, Browser doesn't contain that.

Solution 2:[2]

you cant run python natively in the browser.

but ofc, there are workarounds, like pypy.js (this compiles python script to javascript and then runs the js)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jinger7281
Solution 2 alexzander