# Onload body py attribut event

**URL:** <https://forum.anaconda.com/t/onload-body-py-attribut-event/50596>\
**Category:** PyScript\
**Created:** [February 12, 2023, 10:23am UTC](https://forum.anaconda.com/t/onload-body-py-attribut-event/50596 "2023-02-12T10:23:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![frchalaoux](https://avatars.discourse-cdn.com/v4/letter/f/80bc00/32.png) [@frchalaoux](https://forum.anaconda.com/u/frchalaoux)\
**Post date:** [February 12, 2023, 10:23am UTC](https://forum.anaconda.com/t/onload-body-py-attribut-event/50596/1 "2023-02-12T10:23:47Z")

</div>

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))

---

<div class="post-metadata">

**Author:** ![frchalaoux](https://avatars.discourse-cdn.com/v4/letter/f/80bc00/32.png) [@frchalaoux](https://forum.anaconda.com/u/frchalaoux)\
**Post date:** [February 12, 2023, 1:49pm UTC](https://forum.anaconda.com/t/onload-body-py-attribut-event/50596/2 "2023-02-12T13:49:06Z")

</div>

I have the same problem with 🙂

---

<div class="post-metadata">

**Author:** ![frchalaoux](https://avatars.discourse-cdn.com/v4/letter/f/80bc00/32.png) [@frchalaoux](https://forum.anaconda.com/u/frchalaoux)\
**Post date:** [February 12, 2023, 2:16pm UTC](https://forum.anaconda.com/t/onload-body-py-attribut-event/50596/3 "2023-02-12T14:16:42Z")

</div>

Precision, I also tested but does not work too:

---

<div class="post-metadata">

**Author:** ![frchalaoux](https://avatars.discourse-cdn.com/v4/letter/f/80bc00/32.png) [@frchalaoux](https://forum.anaconda.com/u/frchalaoux)\
**Post date:** [February 12, 2023, 2:20pm UTC](https://forum.anaconda.com/t/onload-body-py-attribut-event/50596/4 "2023-02-12T14:20:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JeffGlass](https://dub1.discourse-cdn.com/anaconda/user_avatar/forum.anaconda.com/jeffglass/32/1301_2.png) [@JeffGlass](https://forum.anaconda.com/u/JeffGlass)\
**Post date:** [February 13, 2023, 2:03pm UTC](https://forum.anaconda.com/t/onload-body-py-attribut-event/50596/5 "2023-02-13T14:03:36Z")

</div>

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:

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

```

---

<div class="post-metadata">

**Author:** ![JeffGlass](https://dub1.discourse-cdn.com/anaconda/user_avatar/forum.anaconda.com/jeffglass/32/1301_2.png) [@JeffGlass](https://forum.anaconda.com/u/JeffGlass)\
**Post date:** [February 13, 2023, 3:48pm UTC](https://forum.anaconda.com/t/onload-body-py-attribut-event/50596/6 "2023-02-13T15:48:33Z")

</div>

I see the same question is up over on a [GitHub Discussion](https://github.com/pyscript/pyscript/discussions/1185), where the formatting is behaving itself. Let’s continue the conversation there.
