At present, I use pycharm to open the HTML document for editing, and then it is very inefficient to write python code in it, because I need to enter the code completely manually, and the IDE will not prompt any PYTHON code.
Hello, and welcome to the forum!
It’s true, the limited tooling for writing Python inside of HTML is unfortunate at the moment. While there’s been some possibility of improvement discussed from both VSCode and PyCharm, at the moment I think the best option is to use the
src attribute of the PyScript tag to locate the code in a separate file.
So your py-script tag becomes:
<py-script src="my_code.py"></py-script>, and your Python code lives in
my_code.py, where hopefully PyCharm (or another IDE) will recognize it and give you autocompletion etc.
It’s worth noting - the
src parameter takes a url, not a file path, so the files do not need to be fetched .