1

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()

Duarte Farrajota Ramos
  • 59,425
  • 39
  • 130
  • 187
Udjani
  • 117
  • 4
  • 3
    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?. – brockmann Jun 16 '20 at 01:50

1 Answers1

4

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()
Duarte Farrajota Ramos
  • 59,425
  • 39
  • 130
  • 187