Setting layer material

Is there a way to set a layers material using python?
I’ve been able to do it using LayerMaterialIndex, but I haven’t had much luck in finding the index for the material that I want. It also seems that these indexes change. Is there another way to change a layer’s material to another loaded nXt material?
Thanks

@JohnM is there .NET access to Flamingo nXt materials?