select template_list entry, run function

Is it possible to automatically run a function/method after selecting an entry in a template_list? If not, does anyone know of a workaround?

if you define your own active prop, supply an argument for the update-parameter

layout.template_list("MATERIAL_UL_matslots_example", "", obj, "material_slots", obj, "active_material_index")

In the above snippet, active_material_index is the active prop. But this one is built-in and you would have to replace it with a custom one.

Ah, you’re absolutely right. I don’t know why I didn’t think of that. Thanks so much!

you’re welcome :slight_smile:

what do you want to do btw.? Don’t operators work?