Hi, I did a lot of tests and find the solution.
If you use a framed based solution, you can send this commands:
window.frames[0].postMessage(JSON.stringify({'MessageId': 'Host_PostmessageReady'}), '*');
window.frames[0].postMessage(JSON.stringify({'MessageId': 'CallPythonScript',
'SendTime': Date.now(),
'ScriptFile': 'InsertText.py',
'Function': 'InsertText',
'Values': {'text': {'type': 'string', 'value': '<<Text to insert>>'}}
}),
'*');
Are you using frame?
More details you can find here: loleaflet/reference.html - online - Gitiles
I have presented a webinar too, with plugins details: