1
$\begingroup$

I followed a tutorial on youtube showing how to make a simple panel on blender, i copied it one to one but the panel is no nowhere to be seen. The script runs fine without errors and I have no idea of what is wrong.

I'm using blender 2.90 following this tutorial:

import bpy


class TestPanel(bpy.types.Panel):
    bl_label = "Test Panel"
    bl_idname = "PT_TestPanel"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'
    bl_category = 'My 1st Addon'
    
    
    def draw(self, context):
        layout = self.layout
        
        row = layout.row()
        row.label(text = "Sample Text")
        
        
def register():
    bpy.utils.register_class(TestPanel)
    
def unregister():
    bpy.utils.unregister_class(TestPanel)


if __name__ == "__main_":
    register()  

$\endgroup$
1
  • 3
    $\begingroup$ You should also add the correct separator (_PT_) to the name of your panel class according to 2.8x API changes. Replace TestPanel by MYADDON_PT_TestPanel and even more important: assign it to bl_idname -> bl_idname = "MYADDON_PT_TestPanel" otherwise you'll get an error in the console. Recommend to read: How to create a custom UI?. $\endgroup$
    – brockmann
    Jun 16, 2020 at 1:50

1 Answer 1

4
$\begingroup$

You are missing one underscore under the registration above the last line in __main__

It reads

if __name__ == "__main_":
    register()

but is supposed to read

if __name__ == "__main__":
    register()
$\endgroup$
2

You must log in to answer this question.

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