Prevent script from overriding Object Style materials

Hi,

I am using a script to generate Revit Generic Model families for a large-scale project. Currently, I define my materials manually via the Object Styles panel. However, rerunning the script seems to usually override these settings, resetting the materials to a ‘default/not defined’ state. Is there a way to prevent the script from overwriting these material assignments?

@harri.humppi I have replicated the process and i dont see any issue.