Onload body py attribut event

Hi, is it possible to call a python fonction with the Onload body py attribut event like as written below ? For the moment it does not work for me ! Any suggestion ?

./cms.py

def refresh():
blablabla

def main():
doc= document.querySelector(“#mydocument”)
doc.addEventListener(“load”, create_proxy(refresh))

I have the same problem with :slight_smile:

Precision, I also tested but does not work too:

There is a problem of interpretation with this forum. Many of my sentences are truncated !!!

How odd! Can you maybe take a screenshot of what you’re typing in the Post Editor (perhaps from one of the above?) so we can try to figure out what’s going on?

One thought: HTML tags surrounded by <brackets> try to be parsed as actual HTML tags, and are therefore not displayed. If this is what you’re running into, you can either:

  • Put a backslash before each bracket to force them not be treated as tags, like this: \<py-script\>
  • Put backticks ` around the tags to create an inline code block, like this: `<py-script>`, which show up as <py-script>
  • Put three backticks ``` in a row to start or end a full code block, like this:

```
<py-script>
#Some code here
</py-script>
```

Which shows up like this:

<py-script>
   #some code here
</py-script>

I see the same question is up over on a GitHub Discussion, where the formatting is behaving itself. Let’s continue the conversation there.