Apply styling to a component via scripting

I have a few components on a view. In an (onActionPerformed) script I have the line of code below where I’m trying to set the component’s background color / style to a valid defined style in (Perspective)(Styles). Each time the line is evaluated Ignition notes the error (NameError: global name ‘WarningColors’ is not defined) = WarningColors.ColorMaintRequested

However, when I apply the ColorMaintRequested style using the Property Editor by selecting it via the (style)(classes) dropdown it works perfectly.

How does one apply the style through scripting commands? Does anyone know?

style.classes is expecting a path to a style, so your assignment should be something along the lines of = "WarningColors/ColorMaintRequested"

That did it Ryan,