touilleMan / godot-python

Python support for Godot 🐍🐍🐍
Other
1.83k stars 136 forks source link

Cannot load because it doesn't expose any class to Godot error when changing scene to the second time #402

Open steven-thegamer opened 2 weeks ago

steven-thegamer commented 2 weeks ago

I got these error when I try to load a scene for the second time.

Pythonscript 0.50.0 (CPython 3.8.5.final.0) hi Cannot load res://test_node.py (test_node) because it doesn't expose any class to Godot

The 'hi' is from a python script attached to a Godot Node with the task to print('hi') on ready. When I change the scene to another scene and open the same scene again, this error pops up as if it can't load the python script. Not the node, but the script itself only. This is what the script does.

from godot import exposed, export
from godot import *

@exposed
class test_node(Node):
    def _ready(self):
        print('hi')

What's wrong with this and does anoyne have a slution?