I'm trying to enter dimensions of an object. I'm using the code below. It does not recognize the variables XX or YY and get the error: Key "XX" not found Any clues??

import bpy
from bpy.props import FloatProperty
from bpy.props import IntProperty
from bpy.types import Operator
import os

#create variables 
bpy.types.Scene.XX=FloatProperty(name="XX", default=10.0, description="Enter XX") #XX
XX = bpy.context.scene['XX']
#print (XX) 

bpy.types.Scene.YY=FloatProperty(name="YY",default=4, description="Enter YY") #YY
YY = bpy.context.scene['YY']
#print (YY) 
#Draw the panel buttons for user inputs
class CustomPanel(bpy.types.Panel):
    bl_label = "Wall"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    def draw(self, context):
        layout = self.layout
        row = layout.row()
        Wall_layout.prop(context.scene, 'XX') #XX
        Wall_layout.prop(context.scene, 'YY') #YY

def register():

def unregister():

if __name__ == "__main__":
  • 1
    $\begingroup$ you should access it like this : scene.XX $\endgroup$
    – Chebhou
    May 3, 2015 at 23:27

1 Answer 1


You have defined a RNA property, it will be available on any instance of this class( all scenes will have this property ) , to access this property use the following line :

XX = context.scene.XX
# in the UI
row.prop(context.scene, 'XX')

you can also define an ID property which will be available only on this scene :

context.scene['XX'] = 10.0
#in UI
row.prop(context.scene, '["XX"]')

To learn more about this Topic refer to this DOC page : RNA properties versus ID properties

  • $\begingroup$ Thanks, this works with the addition of: XX=bpy.context.scene.XX $\endgroup$ May 4, 2015 at 16:20

You must log in to answer this question.

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