Material dynamic association

Hi everyone.
I would like to know how to switch a material (imported with an fbx model) with another material picked up from my materials library, programmatically.
myFbx.fbx comes with material “A”, “B”, “C”.
i would run a script that substitutes “A” with “/myMat/A1”, “B” with “/myMat/B1” and so on.
then the new materials association has to be mantained.
NB: of course, i need to run the application once to do the materials switch, then stop when the process finishes, then continue working with my just reskinned model.

is it possible?
Thank you!