title: Blender 3D Add-on Script loading failed
body: <h2>Heading</h2>
  
  <p>I made add-on script.</p>
  
  <p>However loading fail in blender UI.</p>
  
  <p>Error message is '_RestrictContext' object has no attribute 'scene' .</p>
  
  <p>But this script is very well run in blender of Text Editor.</p>
  
  <p>Why don't load this add-on?</p>
  
  <pre><code>bl_info = {
      "name": "Add Cube",
      "author": "jsh",
      "version": (1, 0),
      "blender": (2, 68, 0),
      "location": "View3D &gt; Tool Shelf &gt; Text make",
      "description": "Adds a new Mesh Object",
      "warning": "",
      "wiki_url": "",
      "tracker_url": "http://togetherall.infomaster.co.kr",
      "category": "Object"}
  
  
  
  import bpy
  from bpy.props import *
  
  #
  #    Store properties in the active scene
  #
  def initSceneProperties(scn):
      bpy.types.Scene.MyInt = IntProperty(
          name = "Integer", 
          description = "Enter an integer")
      scn['MyInt'] = 17
  
      bpy.types.Scene.MyFloat = FloatProperty(
          name = "Float", 
          description = "Enter a float",
          default = 33.33,
          min = -100,
          max = 100)
  
      bpy.types.Scene.MyBool = BoolProperty(
          name = "Boolean", 
          description = "True or False?")
      scn['MyBool'] = True
  
      bpy.types.Scene.MyEnum = EnumProperty(
          items = [('Eine', 'Un', 'One'), 
                   ('Zwei', 'Deux', 'Two'),
                   ('Drei', 'Trois', 'Three')],
          name = "Ziffer")
      scn['MyEnum'] = 2
  
      bpy.types.Scene.MyString = StringProperty(
          name = "String2")
      scn['MyString'] = "Lorem ipsum dolor sit amet"
      return
  
  initSceneProperties(bpy.context.scene)
  
  #
  #    Menu in UI region
  #
  class UIPanel(bpy.types.Panel):
      bl_label = "Make Text"
      bl_space_type = "VIEW_3D"
      #bl_region_type = "UI"
      bl_region_type = "TOOL_PROPS"
  
  
      def draw(self, context):
          layout = self.layout
          scn = context.scene
          layout.prop(scn, 'MyInt', icon='BLENDER', toggle=True)
          layout.prop(scn, 'MyFloat')
          layout.prop(scn, 'MyBool')
          layout.prop(scn, 'MyEnum')
          layout.prop(scn, 'MyString')
          layout.operator("idname_must.be_all_lowercase_and_contain_one_dot")
  
  #
  #    The button prints the values of the properites in the console.
  #
  
  class OBJECT_OT_PrintPropsButton(bpy.types.Operator):
      bl_idname = "idname_must.be_all_lowercase_and_contain_one_dot"
      bl_label = "make"
  
      def execute(self, context):
          bpy.ops.mesh.primitive_cube_add()       
          return{'FINISHED'}    
  
  def printProp(label, key, scn):
      try:
          val = scn[key]
      except:
          val = 'Undefined'
      #print("%s %s" % (key, val))
      return val
  
  
  
  def register():
      bpy.utils.register_class(UIPanel)
      bpy.utils.register_class(OBJECT_OT_PrintPropsButton)
  
  def unregister():
      bpy.utils.unregister_class(UIPanel)
      bpy.utils.unregister_class(OBJECT_OT_PrintPropsButton)
  
  
  
  if __name__ == "__main__":
      register()
  </code></pre>