# How to check if the active object is using no material

Is there a way, to check if the current object is using no material for cycles engine, so that the code could take a logical decision based on that!

Get all the materials

materials = bpy.context.active_object.data.materials


Count the material slots

nMat = len(materials)


Check if a material slot is empty (in this case, the first slot)

isEmpty = not materials[0]