Painting Setting

In normal case resetting the simulation sets back the original material of the component.
But if you want to change the material using python script you can check this tutorial:

Thank you very much for your answer. The problem I have now is that every time the software is closed and restarted, the color can not be sprayed, or the color of the spray is wrong. You have to select the components in the spray tool, and you have to do this every time. Instead of going to a spray tool, I wanted to automatically change the properties of the spray component through a python script each time before painting, May I ask if I can keep the original material of the group and spray paint on the original grey material?