Python within a WebExtension context?

Can scripts written in Python run within a WebExtension?

WebExtension is basically a web application with access to some special browser API.
So you can use only languages that are supported by the browser, which is JavaScript and WebAssembly.

However you could use one of the existing transpilers that translates “foreign” language into JavaScript/WebAssembly.
This is how people using TypeScript or even Scala can write web application.

However, it may bring some overhead depending on what you are trying to do so often it’s not a good idea. It’s best to discuss it with experts.

I remember some Mozilla project about running Python in the browser using WebAssembly: