You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
Bumping this, because I hit a very similar problem. Reloading the project doesn't work, I tried resetting godot (turning it off and on) didn't help. Also this problem happens only if the scene contains a python script in a node.. I "fixed" it by changing the script to a GDScript, but that isn't really a good solution..
Bumping this, because I hit a very similar problem. Reloading the project doesn't work, I tried resetting godot (turning it off and on) didn't help. Also this problem happens only if the scene contains a python script in a node.. I "fixed" it by changing the script to a GDScript, but that isn't really a good solution..
Have you or anyone else found a fix for this?
Okay, I have fixed it by loading all the scenes only once in an autoloaded singleton script and then swapping to them when I need to;
SceneSwapper.gd:
varscenes= {
"AnalysisStage": load("res://AnalysisStage.tscn"),
"Game": load("res://game.tscn"),
}
func_ready():
# This loads all menu scenes from a project directoryvardirectory=Directory.new()
ifdirectory.open("res://MainMenuScreens/") ==OK:
directory.list_dir_begin()
varfile_name=directory.get_next()
whilefile_name!="":
iffile_name=="."orfile_name==".."orfile_name.begins_with("__"):
file_name=directory.get_next()
continueiffile_name.ends_with(".tscn"):
scenes[file_name.split(".tscn")[0]] =load("res://MainMenuScreens/"+file_name)
file_name=directory.get_next()
#potentially unsafefuncget_scene(scene_name) ->PackedScene:
returnscenes[scene_name]
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.
What's wrong with this and does anoyne have a slution?
The text was updated successfully, but these errors were encountered: