# Automatically update an UIList

I've created an own UIList for an addon. It's just used to display some properties of Action (as that one doesn't have a properties panel in the Action Editor), so it must get populated with actions and not with user input.

It actually must be updated manually, with a button I added below it. Althought this already works, I think it's not nice, so I was wondering if there was any way to update the list automatically.

I tried to override the draw method and override it there, but then the List (and the panel in general) isn't displayed at all.

def draw(self, context):
# LIST UPDATE
bpy.types.UIList.draw(self, context)


Here's my UIList implementation:

class MyUIList(bpy.types.UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):

custom_icon = 'OBJECT_DATAMODE'

if self.layout_type in {'DEFAULT', 'COMPACT'}:
layout.label(bpy.data.actions[item.Index].name, icon = custom_icon)

elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
layout.label("", icon = custom_icon)


• Good thread here blenderartists.org/forum/…. Also surely your line 7 above could be layout.label(item.name) as bpy.data and "actions" are passed to the template_list layout. Sep 9, 2015 at 6:17
• @batFINGER Why not converting this into an answer? Might be also interesting: blender.stackexchange.com/a/14203/3710
– p2or
Sep 9, 2015 at 10:46

The trick had to be done in the panel draw method, when drawing the UIList:
row.template_list("MyList", "", bpy.data, "actions", context.scene, "myListIndex")

The third and fourth arguments are the place from were the list items will be get. I was using a custom list here (that just pointed to an action), so that was redundant. The fifth and sixth arguments are where the selected item index is stored, which in my case is in the Scene properties.