Creating Notes with attachments via python API

Hi all!
I need to create Notes and upload attachments to them via scripting.

This is how they show up. The uploaded image is displayed as a reply of sorts, and the user is the script name.

What I’d like to achieve is something like what we would get by doing the same by hand through the Shotgrid user interface. Like this:

I’m not really sure if I’m doing something wrong or if it’s not currently possible to achieve the same result via the api.
Any suggestion is welcome!