One works (Installs as an addon), the other doesn't - is it even related

They both work from the editor.

This installs fine:

import bpy
from bpy.types import Panel

#Class for the Panel, Derived by Panel
class SimpleToolPanel(Panel):
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    bl_label = 'Add Assorted Objects'    
    bl_context = 'objectmode'
    bl_category = 'Objects_Add'

    #Add UI Elements here
    def draw(self, context):
        layout = self.layout
        layout.operator('mesh.primitive_solid_add', text = 'Add Regular Solids', icon='MESH_ICOSPHERE')
        layout.operator('mesh.primitive_xyz_function_surface', text = 'Add XYZ Function Surface', icon='OUTLINER_DATA_SURFACE')
        layout.operator('curve.torus_knot_plus', text = 'Add Curve - Torus Knot Plus', icon='MESH_TORUS')        
        layout.operator('mesh.generate_geodesic_dome', text = 'Add Geodesic Dome', icon='MESH_ICOSPHERE') 

#Register
def register():
    bpy.utils.register_class(SimpleToolPanel)

#Unregister
def unregister():
    bpy.utils.unregister_class(SimpleToolPanel)
    
#Needed to run script in Text Editor    
if __name__ == '__main__':
    register()

this, doesn’t:


#----------------------------------------------------------
# File: tools_menu_Xtra_Objects.py
#----------------------------------------------------------
bl_info = {
    "name": "Xtra Objects",
    "version": (0, 0, 1),
    "location": "View3D > Tool Shelf",
    "description": "Add Objects - Mesh, Curves",
    "category": "Object"}

import bpy
 
#   Layout panel
#class SimpleToolPanel(Panel):
#    bl_space_type = 'VIEW_3D'
#    bl_region_type = 'TOOLS'
#    bl_label = 'Xtra Objects'    
#    bl_context = 'objectmode'
#   bl_category = 'Xtra_Objects'
    
class LayoutPanel(bpy.types.Panel):
    bl_label = "Xtra Objects"
    bl_space_type = "VIEW_3D"
    bl_context = 'objectmode'
    bl_region_type = "TOOLS"    
 
    def draw(self, context):
        layout = self.layout
        
        layout.label("Diamonds")
        row = layout.row(align=True)
#        row.alignment = 'EXPAND'
        row.alignment = 'LEFT'
        row.operator('mesh.primitive_brilliant_add', text = 'Brilliant', icon='PMARKER_ACT')
        row.operator('mesh.primitive_diamond_add', text = 'Diamond', icon='PMARKER_ACT')
        row.operator('mesh.primitive_gem_add', text = 'Gem', icon='PMARKER_ACT')           

        layout.label("Other Objects")
        row = layout.row(align=True)
#        row.alignment = 'EXPAND'
        row.alignment = 'LEFT'
        row.operator('mesh.add_beam', text = 'Beam Builder', icon='OUTLINER_DATA_MESH')
        row.operator('mesh.wall_add', text = 'Wall Factory', icon='OUTLINER_DATA_MESH')

        row = layout.row(align=True)
#        row.alignment = 'EXPAND'
        row.alignment = 'LEFT'
        row.operator('mesh.primitive_star_add', text = 'Simple Star', icon='OUTLINER_DATA_MESH')           
        row.operator('mesh.primitive_steppyramid_add', text = 'Step Pyramid', icon='OUTLINER_DATA_MESH')
        row.operator('mesh.honeycomb_add', text = 'Honeycomb', icon='OUTLINER_DATA_MESH')
        row.operator('mesh.primitive_teapot_add', text = 'Teapot', icon='OUTLINER_DATA_MESH')           
 
#   Button
class OBJECT_OT_Button(bpy.types.Operator):
    bl_idname = "my.button"
    bl_label = "Button"
    number = bpy.props.IntProperty()
    row = bpy.props.IntProperty()
    loc = bpy.props.StringProperty()
 
    def execute(self, context):
        if self.loc:
            words = self.loc.split()
            self.row = int(words[0])
            self.number = int(words[1])
        print("Row %d button %d" % (self.row, self.number))
        return{'FINISHED'}    

#Register
#def register():
#    bpy.utils.register_class(LayoutPanel)

#Unregister
#def unregister():
#    bpy.utils.unregister_class(LayoutPanel)

 
#    Registration
#bpy.utils.register_module(__name__)

#Needed to run script in Text Editor    
if __name__ == '__main__':
    register()

They both started out here:

Blender Addons with Python Tutorial:

and got (cut and paste, tweaked) mashed up with this:

>> Panel layout and several arguments <<
(layout.py)

Dev:Py/Scripts/Cookbook/Code snippets/Interface
https://wiki.blender.org/index.php/Dev:Py/Scripts/Cookbook/Code_snippets/Interface

I’ve tried several variations based on what I can find from Search (web).

Nothing seems to be working.

Using 2.78. Everything accessed is built in to 2.78.

I’m stumped.

You do realize you have your registering and un-registering code lines as a comment.

#Register(Both lines below have the #sign)
#def register():
#    bpy.utils.register_class(LayoutPanel)

#Unregister(Both lines below have the #sign)
#def unregister():
#    bpy.utils.unregister_class(LayoutPanel)

 
#    Registration
#bpy.utils.register_module(__name__)

#Needed to run script in Text Editor    
if __name__ == '__main__':
    register()

I do.

There are several.

I’ve tried them all.

Same result.

Just left them, so you could see what I’ve tried.

None of them have worked.

Were you getting a error when trying to enable the addon? I just tried it as a addon and it was giving a error.
Try this and see if it works. it works here.

#----------------------------------------------------------
# File: tools_menu_Xtra_Objects.py
#----------------------------------------------------------
    
    
bl_info = {
    "name": "Xtra Objects",
    "version": (0, 0, 1),    
    "location": "View3D &gt; Tool Shelf",
    "description": "Add Objects - Mesh, Curves",
    "category": "Object",
}


import bpy
 

    
class MyXtraObjectsPanel(bpy.types.Panel):
    bl_label = "Xtra Objects"
    bl_space_type = "VIEW_3D"
    bl_context = 'objectmode'
    bl_region_type = "TOOLS"    
 
    def draw(self, context):
        layout = self.layout
        
        layout.label("Diamonds")
        row = layout.row(align=True)
#        row.alignment = 'EXPAND'
        row.alignment = 'LEFT'
        row.operator('mesh.primitive_brilliant_add', text = 'Brilliant', icon='PMARKER_ACT')
        row.operator('mesh.primitive_diamond_add', text = 'Diamond', icon='PMARKER_ACT')
        row.operator('mesh.primitive_gem_add', text = 'Gem', icon='PMARKER_ACT')           

        layout.label("Other Objects")
        row = layout.row(align=True)
#        row.alignment = 'EXPAND'
        row.alignment = 'LEFT'
        row.operator('mesh.add_beam', text = 'Beam Builder', icon='OUTLINER_DATA_MESH')
        row.operator('mesh.wall_add', text = 'Wall Factory', icon='OUTLINER_DATA_MESH')

        row = layout.row(align=True)
#        row.alignment = 'EXPAND'
        row.alignment = 'LEFT'
        row.operator('mesh.primitive_star_add', text = 'Simple Star', icon='OUTLINER_DATA_MESH')           
        row.operator('mesh.primitive_steppyramid_add', text = 'Step Pyramid', icon='OUTLINER_DATA_MESH')
        row.operator('mesh.honeycomb_add', text = 'Honeycomb', icon='OUTLINER_DATA_MESH')
        row.operator('mesh.primitive_teapot_add', text = 'Teapot', icon='OUTLINER_DATA_MESH')           
 
#   Button
class OBJECT_OT_Button(bpy.types.Operator):
    bl_idname = "my.button"
    bl_label = "Button"
    number = bpy.props.IntProperty()
    row = bpy.props.IntProperty()
    loc = bpy.props.StringProperty()
 
    def execute(self, context):
        if self.loc:
            words = self.loc.split()
            self.row = int(words[0])
            self.number = int(words[1])
        print("Row %d button %d" % (self.row, self.number))
        return{'FINISHED'}    

#Register
def register():
    bpy.utils.register_class(MyXtraObjectsPanel)

#Unregister
def unregister():
    bpy.utils.unregister_class(MyXtraObjectsPanel)
 

#Needed to run script in Text Editor    
if __name__ == '__main__':
    register()

Yes, I was getting an error.

Now, I’m running Blender 2.78 on two different systems. One is 32 bit (Linux). The other is 64 bit
(Linux) - both Ubuntu - Latest version.

This WORKS on the 64 bit system, but, crashes on the 32 bit system:


#----------------------------------------------------------
# File: tools_menu_Xtra_Objects.py
#----------------------------------------------------------
bl_info = {
    "name": "Xtra Objects",
    "version": (0, 0, 1),
    "location": "View3D &gt; Tool Shelf",
    "description": "Add Objects - Mesh, Curves",
    "category": "Object"}

import bpy
 
#   Layout panel
#class SimpleToolPanel(Panel):
#    bl_space_type = 'VIEW_3D'
#    bl_region_type = 'TOOLS'
#    bl_label = 'Xtra Objects'    
#    bl_context = 'objectmode'
#   bl_category = 'Xtra_Objects'
    
class LayoutPanel(bpy.types.Panel):
    bl_label = "Xtra Objects"
    bl_space_type = "VIEW_3D"
    bl_context = 'objectmode'
    bl_region_type = "TOOLS"    
 
    def draw(self, context):
        layout = self.layout
        
        layout.label("Diamonds")
        row = layout.row(align=True)
#        row.alignment = 'EXPAND'
        row.alignment = 'LEFT'
        row.operator('mesh.primitive_brilliant_add', text = 'Brilliant', icon='PMARKER_ACT')
        row.operator('mesh.primitive_diamond_add', text = 'Diamond', icon='PMARKER_ACT')
        row.operator('mesh.primitive_gem_add', text = 'Gem', icon='PMARKER_ACT')           

        layout.label("Other Objects")
        row = layout.row(align=True)
#        row.alignment = 'EXPAND'
        row.alignment = 'LEFT'
        row.operator('mesh.add_beam', text = 'Beam Builder', icon='OUTLINER_DATA_MESH')
        row.operator('mesh.wall_add', text = 'Wall Factory', icon='OUTLINER_DATA_MESH')

        row = layout.row(align=True)
#        row.alignment = 'EXPAND'
        row.alignment = 'LEFT'
        row.operator('mesh.primitive_star_add', text = 'Simple Star', icon='OUTLINER_DATA_MESH')           
        row.operator('mesh.primitive_steppyramid_add', text = 'Step Pyramid', icon='OUTLINER_DATA_MESH')
        row.operator('mesh.honeycomb_add', text = 'Honeycomb', icon='OUTLINER_DATA_MESH')
        row.operator('mesh.primitive_teapot_add', text = 'Teapot', icon='OUTLINER_DATA_MESH')           

        layout.label("Gears")
        row = layout.row(align=True)
#        row.alignment = 'EXPAND'
        row.alignment = 'LEFT'
        row.operator('mesh.primitive_gear', text = 'Gear', icon='SCRIPTWIN')
        row.operator('mesh.primitive_worm_gear', text = 'Worm', icon='SCRIPTWIN')

        layout.label("Torus Objects")
        row = layout.row(align=True)
#        row.alignment = 'EXPAND'
        row.alignment = 'LEFT'
        row.operator('mesh.primitive_torusknot_add', text = 'Torus Objects - Mesh', icon='MESH_TORUS')

#   Button
class OBJECT_OT_Button(bpy.types.Operator):
    bl_idname = "my.button"
    bl_label = "Button"
    number = bpy.props.IntProperty()
    row = bpy.props.IntProperty()
    loc = bpy.props.StringProperty()
 
    def execute(self, context):
        if self.loc:
            words = self.loc.split()
            self.row = int(words[0])
            self.number = int(words[1])
        print("Row %d button %d" % (self.row, self.number))
        return{'FINISHED'}    

#Register
#def register():
#    bpy.utils.register_class(LayoutPanel)

#Unregister
#def unregister():
#    bpy.utils.unregister_class(LayoutPanel)

 
#    Registration
bpy.utils.register_module(__name__)

#Needed to run script in Text Editor    
#if __name__ == '__main__':
#    register()

AFWS, yours worked fine on my 32 bit system.

Either it’s something in the code or maybe in the OS.

Now, I haven’t tried yours on the 64 bit system yet.

That would help determine if it’s the code or the system.

Update:

I’ve tried all the working code on both my 32 and 64 bit systems.

Working on both.

For the record, here’s the working code, cleaned up, and expanded.

I just thought it would be nice to have a good number of the curve and mesh objects
that I frequently use under one umbrella rather than having to click down into the menus
every time.

This just seems more useful and convenient.

Nicer would be having it all under one panel rather than two, or better yet, the ability
to select and add or remove objects to the panel from a menu.

That might make it a more useful and polished addon overall.

Either is beyond my coding abilities at the moment.

Still they function as useful for my needs.

Feel free to tweak as you see fit.

Assorted Objects:

NOTE: I added a “Simple Curves” button dependent on having the Simple Curves addon installed.
It can simply be removed if it causes problems or inconvenience.


#----------------------------------------------------------
# File: MyAssortedObjects_Addon.py
# Last Updated: Oct 20, 2016
#----------------------------------------------------------

bl_info = {
    "name": "Add Assorted Objects",
    "version": (0, 0, 1),
    "location": "View3D &gt; Tool Shelf",
    "description": "Add Assorted Objects",
    "warning": "Simple Curves Addon must be installed for the Simple Curves Button to work: https://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Curve/Simple_curves",
    "category": "Object"}

import bpy
from bpy.types import Panel

#Class for the Panel, Derived by Panel
class SimpleToolPanel(Panel):
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    bl_label = 'Add Assorted Objects'    
    bl_context = 'objectmode'
    bl_category = 'Objects_Add'

    #Add UI Elements here
    def draw(self, context):
        layout = self.layout
        layout.operator('mesh.primitive_solid_add', text = 'Add Regular Solids', icon='MESH_ICOSPHERE')
        layout.operator('mesh.primitive_xyz_function_surface', text = 'Add XYZ Function Surface', icon='OUTLINER_DATA_SURFACE')
        layout.operator('curve.torus_knot_plus', text = 'Add Curve - Torus Knot Plus', icon='MESH_TORUS')        
        layout.operator('mesh.curveaceous_galore', text = 'Add Curve Profiles', icon='MESH_TORUS')                
        # REQUIRES simple curves addon be installed
        layout.operator('curve.simple', text = 'Add Simple Curves', icon='MESH_TORUS')                
        layout.operator('mesh.generate_geodesic_dome', text = 'Add Geodesic Dome', icon='MESH_ICOSPHERE') 

#Register
def register():
    bpy.utils.register_class(SimpleToolPanel)

#Unregister
def unregister():
    bpy.utils.unregister_class(SimpleToolPanel)
    
#Needed to run script in Text Editor    
if __name__ == '__main__':
    register()

Xtra Objects:


#----------------------------------------------------------
# File: MyXtraObjects_Addon.py
# Last Updated: Oct 20, 2016
#----------------------------------------------------------
    
    
bl_info = {
    "name": "Xtra Objects",
    "version": (0, 0, 1),    
    "location": "View3D &gt; Tool Shelf",
    "description": "Add Objects - Mesh, Curves",
    "category": "Object",
}

import bpy
   
class MyXtraObjectsPanel(bpy.types.Panel):
    bl_label = "Xtra Objects"
    bl_space_type = "VIEW_3D"
    bl_context = 'objectmode'
    bl_region_type = "TOOLS"
    # Added Line Below
    bl_category = 'Objects_Add'        
 
    def draw(self, context):
        layout = self.layout
        
        layout.label("Diamonds")
        row = layout.row(align=True)
        row.alignment = 'LEFT'
        row.operator('mesh.primitive_brilliant_add', text = 'Brilliant', icon='PMARKER_ACT')
        row.operator('mesh.primitive_diamond_add', text = 'Diamond', icon='PMARKER_ACT')
        row.operator('mesh.primitive_gem_add', text = 'Gem', icon='PMARKER_ACT')           

        layout.label("Other Objects")
        row = layout.row(align=True)
        row.alignment = 'LEFT'
        row.operator('mesh.add_beam', text = 'Beam Builder', icon='OUTLINER_DATA_MESH')
        row.operator('mesh.wall_add', text = 'Wall Factory', icon='OUTLINER_DATA_MESH')

        row = layout.row(align=True)
        row.alignment = 'LEFT'
        row.operator('mesh.primitive_star_add', text = 'Simple Star', icon='OUTLINER_DATA_MESH')           
        row.operator('mesh.primitive_steppyramid_add', text = 'Step Pyramid', icon='OUTLINER_DATA_MESH')
        row.operator('mesh.honeycomb_add', text = 'Honeycomb', icon='OUTLINER_DATA_MESH')
        row.operator('mesh.primitive_teapot_add', text = 'Teapot', icon='OUTLINER_DATA_MESH')           

        layout.label("Gears")
        row = layout.row(align=True)
        row.alignment = 'LEFT'
        row.operator('mesh.primitive_gear', text = 'Gear', icon='SCRIPTWIN')
        row.operator('mesh.primitive_worm_gear', text = 'Worm', icon='SCRIPTWIN')

        layout.label("Torus Objects")
        row = layout.row(align=True)
        row.alignment = 'LEFT'
        row.operator('mesh.primitive_torusknot_add', text = 'Torus Objects - Mesh', icon='MESH_TORUS')
 
#   Button
class OBJECT_OT_Button(bpy.types.Operator):
    bl_idname = "my.button"
    bl_label = "Button"
    number = bpy.props.IntProperty()
    row = bpy.props.IntProperty()
    loc = bpy.props.StringProperty()
 
    def execute(self, context):
        if self.loc:
            words = self.loc.split()
            self.row = int(words[0])
            self.number = int(words[1])
        print("Row %d button %d" % (self.row, self.number))
        return{'FINISHED'}    

#Register
def register():
    bpy.utils.register_class(MyXtraObjectsPanel)

#Unregister
def unregister():
    bpy.utils.unregister_class(MyXtraObjectsPanel)
 

#Needed to run script in Text Editor    
if __name__ == '__main__':
    register()