game freezes when restarting scene

Dear artists!

Currently working on a new project and I almost finished the loading and saving system.

There is only one little bug I am having:

Console: SystemError: Blender Game Engine data has been freed, cannot use this python variablethe game freezes at this point.
This happens when I press a key (Q) to restart the scene which which should put me into the main menu.
The scene restarts frozen.
any ideas 0.o

This is workaround to not having to delete every unnecessary object
I might just use overly scenes but in theory this should work

gl nolzett

Hi. I think this error occurs when your code refers to a game object which doesn’t exist. So you can print(scene.objects) before the problematic line and check if your game object exists.

Yes, you refer to an ended game object.