# How to find the name of the active material with python

I want to add nodes to a node group, but for that, I need to know the name of the currently selected material. How can I find the active material with python?

• Do you mean 'active' as in the selected group in the node editor? – Ray Mairlot May 30 '16 at 17:15
• Also, do you want to find the active material or the active node group? The title is asking one thing but the question itself implies something else. – Ray Mairlot May 30 '16 at 17:18
• I want to know the name of the currently selected material. – John Roper May 30 '16 at 20:56

The answer is bpy.context.active_object.active_material.name