This has been reported a few times over the years.  The 2016 reference sounds like it was resolved, but then reappeared in 2019.  That thread didn't seem to conclude.

From 2019: https://app.roll20.net/forum/post/7266026/

From 2016:  https://app.roll20.net/forum/post/3124784/

I encountered this again last month, but haven't seen a response yet:  https://app.roll20.net/forum/post/8514781/

So I'm reporting again in hopes of someone else encountering this.  Here is a very basic example that anyone can enter into a custom sheet sandbox:


<input type="numbername="attr_statvalue="0" />

<script type="text/worker">
  on('sheet:opened', () => {
    setAttrs({'stat': 1})
    });
  
    on('change:stat', (eventInfo) => {
      console.log(eventInfo);
    });
</script>


When you open the sheet, you can see the stat is properly set to 1 (from a default value of zero, or whatever was saved in the input value).  When you change the number field, you can see the console log fires with the eventInfo.  However, that console log never appears when the sheet is opened and the value is changed to1 with the setAttrs inside a sheet:opened event.  Though the stat value is changed, it doesn't seem to fire a change event.

I was hoping to use a method similar to this to init a bunch of stats when a sheet is opened (which it does), but any listeners to those stats changing don't pick it up (like skill calcs dependent on the value of the stat).