Is there a way to set Object Flags in script?

Hi everyone!

I have a script which lets me spawn different objects in different jobs.
In one job I want to spawn a swing barrier like “prop_sec_barier_04a”. Spawning them works so far, but I’m not able to make them move when i come close with a car.

Is there a way to set the same flags by script when i spawn them as i would set in codewalker? The doorflag from createObject doesn’t work on them.

thanks in advance!