Launch flatpak app from LibreOffice script

I’d like to launch a flatpak app from a python script in LibreOffice. It’s working fine from a python console

from subprocess import Popen
Popen (["flatpak", "run", "org.example.myapp"])

The same snippet from a script (macro) in LibreOffice returns:

bwrap: Can't open /proc/self/mountinfo: Permission denied
bwrap: Can't read from privileged_op_socket

Any ideas why? Seems like a sandbox problem, can you shade some light on what this actually means or what it might mean?

Check “flatpak-spawn”

Thanks for your input; it turned out to be a restrictive AppArmor profile for LibreOffice.