How do I register 'Scene' properties with Python in 2.8? I'm currently udpating some 2.7x script for 2.8. Everything is going fine except for one thing:

Currently the script uses a class to store some properties like so:

class MySettings(PropertyGroup):

lockHead = BoolProperty(
    name="Enable or Disable",
    description="Lock the head position of the bone",
    default = False
    )


which is registered in the registration part:

def register():
    bpy.types.Scene.my_tool = PointerProperty(type=MySettings)

def unregister():
    del bpy.types.Scene.my_tool


The issue is, Blender 2.8 doesn't want to register it in the Scene. I try to register it in the Window like so :

def register():
    bpy.types.Window.my_tool = PointerProperty(type=MySettings)

def unregister():
    del bpy.types.Window.my_tool


But then I can't get the property elsewhere (if I get it with context.window.my_tool I just have some weird tuple and can't reach the property itself). Here's an example where I try to get them in a separate  UI class:

def draw (self, context):

    layout = self.layout

    mytool = context.window.my_tool

    rows = 2
    row = layout.row(align=True)
    row.prop(mytool, "lockHead",  icon='NDOF_DOM', text="Head")


So the question is, where can I register the PropertyGroup class so I can access the properties inside in an other class? Or am I doing something commpletly wrong?

And side question, since the classes are no longer stored in the bpy.types "class", how can I get them?
Annotations in 2.80

Not sure of the problem here. 2.8 uses annotations, currently not doing so produces a warning message.

Test code to confirm operation in 2.80

import bpy

class MySettings(bpy.types.PropertyGroup):
    # use an annotation
    lockHead : bpy.props.BoolProperty(
        name="Enable or Disable",
        description="Lock the head position of the bone",
        default=False
        )

def register():
    bpy.utils.register_class(MySettings)
    bpy.types.Scene.my_tool = bpy.props.PointerProperty(type=MySettings)

if __name__ == "__main__":
    register()
    print(bpy.context.scene.my_tool.lockHead)


Test in console:

&gt;&gt; C.scene.my_tool
bpy.data.scenes['Scene'].my_tool

&gt;&gt;&gt; C.scene.my_tool.lockHead
False

&gt;&gt;&gt; C.scene.my_tool.lockHead = True
&gt;&gt;&gt; C.scene.my_tool.lockHead
True


Trying on bpy.types.Window is an issue. The use of bpy.props is restricted to ID types.  As a rule of thumb  objects in the bpy.data collections are ID type..  Scene type in bpy.data.scenes.  There is no bpy.data.windows for the Window type.  (there is the window manager)

&gt;&gt;&gt; isinstance(C.window, bpy.types.ID)
False

&gt;&gt;&gt; isinstance(C.window_manager, bpy.types.ID)
True

&gt;&gt;&gt; bpy.types.WindowManager.my_tool = bpy.types.Scene.my_tool
&gt;&gt;&gt; C.window_manager.my_tool.lockHead
False


Only a rule of thumb test, as shown by a pose bone.

&gt;&gt;&gt; bpy.types.PoseBone.my_tool = bpy.types.Scene.my_tool
&gt;&gt;&gt; C.active_pose_bone
bpy.data.objects['Armature'].pose.bones["Bone"]

&gt;&gt;&gt; C.active_pose_bone.my_tool.lockHead
False

&gt;&gt;&gt; isinstance(C.active_pose_bone, bpy.types.ID)
False


A more robust test, If a blender object doesn't support ID properties, it cannot be used to store custom properties defined with bpy.props

&gt;&gt;&gt; C.window["x"] = 3
Traceback (most recent call last):
  File "&lt;blender_console&gt;", line 1, in &lt;module&gt;
TypeError: bpy_struct[key] = val: id properties not supported for this type