I'm using the BGE to read a custom property that I set in Blender on the default Cube object. For some reason, the property doesn't show up in the BGE? Am I missing something obvious? All the documentation I can find says I can just access it with obj['propertyName'], but it doesn't work.

cube = bge.logic.getCurrentScene().objects["Cube"]
print(cube['min'])  # KeyError: 'value = gameOb[key]: KX_GameObject, key "min" does not exist'
print(cube.get('min'))  # Returns None
print(cube.getPropertyNames())  # Empty list
print(cube.attrDict)  # Empty dictionary

Version is Blender 2.78; to run the engine, I just do blenderplayer myfile.blend.


2 Answers 2


Custom properties belong to Blender. They are not converted and do not exist in the BGE.

You need to set up game properties (game logic editor).

  • $\begingroup$ Oh, so that's what I was missing. Custom Properties != Game Properties. But why does cube.get('min') work, and cube['min'] does not? $\endgroup$
    – JackD
    Commented May 23, 2017 at 8:50
  • $\begingroup$ Both work. The difference is that dict.get(key, fallbackValue) returns the fallback value (defaults to None) when there is no entry with the provided key while dict[key] will result in an KeyError. $\endgroup$
    – Monster
    Commented May 26, 2017 at 11:15

In the script that is run by the Blender 2.79 BGE include:

import bpy 

yeah, I know it's against the rules.
Then use this line to access the object's custom properties

variable = bpy.data.objects['ObjectName']['custom property'] 
  • 2
    $\begingroup$ The reason it's "against the rules" is because this will only work in blender. The stand alone player does not have the bpy module, so your code will not work. $\endgroup$
    – David
    Commented Sep 28, 2018 at 1:51

You must log in to answer this question.

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