Editor Scripting

Is it possible to (permanently) change the texture assigned to a material via script?

Yes change the sharedMaterial texture and it will update the one in the project.