Not sure if this fits the forum topic but does flatpak know how to interact with other instances of itself?

I have a program that makes sure that it is not possible to open two instances at once and does it with the following code.

    if [[ ! -z "$(pgrep -a yad_v12_3 | grep "{--notification" | awk '{print $1}')" ]]] ; then
        kill -s SIGUSR1 "`pgrep -a yad_v12_3 | grep "\--notification" | awk '{print $1}'`" 2>/dev/null
    kill -n 9 `pgrep -a | grep -i '/PortProton/' | awk '{print $1}'`` > /dev/null 2>&1
    killall yad_v12_3 &>/dev/null

But inside flatpak this code does not work, the question is how it should be adapted to work and if it is possible at all or if each flatpak application is a separate container not able to interact with each other.

Each flatpak app instance runs in a PID namespace, so they can’t see each other’s processes.

Single-instance apps often use D-Bus for this (e.g. via GApplication), but that is cooperative. I don’t think there’s any way to forcibly kill the other instance.

Not sure if this would fit the bill but I guess you could at least try it