r/PyScript • u/CookiesDeathCookies • Dec 12 '22
Can PyScript be used in in-browser development console?
I want to manipulate html objects after the page is rendered (for example manipulate youtube.com elements) using Python or Python-JS mixture. Is this possible?
5
Upvotes
View all comments
2
u/TheSwami Dec 13 '22
From your question and title, I'm not sure if you're looking to run Python in the dev console, or just a way to manipulate HTML elements on the page via Python in a py-script tag. The former is not possible, the later is though.
Using
import jsallows access to all of the JavaScript global namespace as a Python module. For a quick sampling of accessing, modifying, and creating HTML elements: