Python: How to display per render layer properties in a UI list? I'm trying to make custom properties per render layer but I get an error. I tried to add a property to bpy.types.SceneRenderLayer and it seems to work. Then I try to make an UIList to show the render layers and that works, but it can't find the prop. I want to make a blender submitter for our render farm and want to have the ability to change things per layer.

The error is:

rna_uiItemR: property not found: SceneRenderLayer.test2


when I print(dir(layer)) for the renderlayer test2 shows up. Here is my code:

import bpy

class RENDER_UL_my_renderlayers(bpy.types.UIList):    
    def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
        layer = item
        row=layout.row()
        print(dir(layer))
        row.prop(layer, 'name', text='')
        row.prop(layer, 'test2', text='')
        row.prop(layer, 'use', text = '')

class TEST_PANEL(bpy.types.Panel):
    bl_label = "TEST"
    bl_idname = "RENDER_PT_ui_test"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "render"

    def draw(self, context):
        layout = self.layout
        col = layout.column()
        col.prop(context.scene, "test1")
        col.template_list('RENDER_UL_my_renderlayers', 'RenderLayers', context.scene.render, 'layers', context.scene, "testindex")

def register():
    bpy.utils.register_class(RENDER_UL_my_renderlayers)
    bpy.utils.register_class(TEST_PANEL)

    bpy.types.Scene.test1 = bpy.props.IntProperty()
    bpy.types.Scene.testindex = bpy.props.IntProperty()
    bpy.types.SceneRenderLayer.test2 = bpy.props.IntProperty()

def unregister():
    bpy.utils.unregister_class(RENDER_UL_my_renderlayers)
    bpy.utils.unregister_class(TEST_PANEL)

    del bpy.types.Scene.test1
    del bpy.types.Scene.test2
    del bpy.types.Scene.testindex


if __name__ == "__main__":
    register()
SceneRenderLayer cannot be assigned a bpy.props property.

From the docs on property defininitions


  Assigning to Existing Classes
  
  Custom properties can be added to any subclass of an ID, Bone and
  PoseBone.


Run a little check in console using builtin issubclass (don't need to consider bone or pose bone in this case)

# bpy.types.Scene.prop = ...
&gt;&gt;&gt; issubclass(bpy.types.Scene, bpy.types.ID)
True

# bpy.types.SceneRenderLayer.prop = ...
&gt;&gt; issubclass(bpy.types.SceneRenderLayer, bpy.types.ID)
False