ah, great - thanks again - that was the "missing link"...

datarepo = pywikibot.site.DataSite('commons', 'commons')
media_identifier = 'M{}'.format(page.pageid) # thanks to https://byabbe.se/2020/09/15/writing-structured-data-on-commons-with-python
dict = {'id': media_identifier }
datarepo.editEntity(dict, <json-payload>, summary='<my summary>')

works fine!

Am 12.09.24 um 19:58 schrieb Amir Sarabadani:
you need to use wbeditentity or some restbase equivalent.