Script does not work with floating menu

If I start the script below with a shortcut, it works as expected.

If I start the same script with the UUID from a floating menu, it does not work. Isn't that strange? :thinking: