Guilin Sun
Ansys Employee

Please check the examples online. If you want more about the Python API please search Github.

You are trying to add a material to the material database, which is not necessary. You only need to assign refractive index to the geometry directly.