I am trying to make a custom panel with two text box which will be assigned to two different lists. However in my panel tool bar, whenever i change one text box, that other automatically changes. I know this is because I am calling both text boxes to "my_string_prop", but everytime i change that name, the text box disappears. Additionally, are the word in the parenthesis key words and if show does anyone know where i can will the list for them.

import bpy

class LayoutDemoPanel(bpy.types.Panel):
    """Creates a Panel in the scene context of the properties editor"""
    bl_label = "Layout Demo"
    bl_idname = "SCENE_PT_layout"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    #bl_context = "scene"

    def draw(self, context):
        layout = self.layout

        scene = context.scene

        row = layout.row()
        row = layout.row()
        row.prop(context.scene, "my_string_prop")
        list1 = [context.scene.my_string_prop]
        print (list1)

        row = layout.row()
        row = layout.row()
        row.prop(context.scene, "my_string_prop" )
        list2 = [context.scene.my_string_prop]

def register():

def unregister():

if __name__ == "__main__":

1 Answer 1


As both items refer to the property my_string_prop they will show the same data. The name of the property used has to exist, if you change the name and it doesn't exist it will not draw the textbox.

To add new properties to the scene object you should add the property in your register function.

bpy.types.Scene.my_string_prop2 = bpy.props.StringProperty(name="String2")

To get a list of items you can use prop_search

row.prop_search(context.scene, "my_string_prop2", bpy.data, "objects")

That will show a list of object names to choose from.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .