I had to make minor changes to the Apple Script to make it work. Referring to the app by id works fine.
yabai -m signal --add event=space_changed \
action="osascript -e 'tell application id \"tracesOf.Uebersicht\" to refresh widget id \"nibar-spaces-primary-jsx\"'"
I had to make minor changes to the Apple Script to make it work. Referring to the app by id works fine.