Detect that we are in Designer for Script

I got a client that execute a switchuser command in a client tag. I wonder if it’s possible to detect that we are in designer because the switchuser command is not allowed in the designer and popping up a warning

You would want to use system.util.getSystemFlags, or check the [System]Client/System/SystemFlags tag (the values on the tag should match with the table on the function page in the user manual).

if system.util.getSystemFlags() > 2:

Thank you! perfect for my case