I am trying to set a Speaker's sound using a Python script and I was able to find that this should be done by assigning to the data.sound
attribute of the Speaker object instance.
I also found that the appropriate value type for the attribute is Sound
, however I have trouble instantiating it. From the documentation it looks like it has a constructor which takes an ID. When passing an empty string, I get a confusing error:
sound = pby.types.Sound('')
TypeError: bpy_struct.new(type): type 'Sound' is not a subtype of bpy_struct
The documentation would have you believe Sound
indeed is a subtype of bpy_struct
, because that's what it says in the base classes line.
However, clicking further through to bpy_struct
, one finds this note:
Note that bpy.types.bpy_struct is not actually available from within Blender, it only exists for the purpose of documentation.
Blender seems to be well aware of it though as it throws an error at me for not instantiating a correct subclass of it.
What gives? How come Blender is aware of this type and how come Sound
is not a proper subclass of it?