Closed gnuchanos closed 5 months ago
It works if the addon and .py script files are in the same place as the build export.
Pythonscript 0.50.0 (CPython 3.8.5.final.0)
ERROR: Failed to retrieve non-existent singleton 'VisualScriptEditor'.
at: get_singleton_object (core/engine.cpp:201)
Cannot retreive singleton VisualScriptEditor
this is test script
@touilleMan hellooooo
Hi @gnuchanos
Godot's export system takes all resources and bundle them together in a single file.
However this is not compatible with how Python works (when doing import foo
Python will try to load foo.py
or foo/__init__.py
[^1]), nor how shared library like libpython.so
(on which libpythonscript.so
depends) are loaded by the OS (here again, the OS need to load the library from the filesystem)
For those reasons, it's tricky to implement Python integration into the Godot export (not impossible though, but so far no work has been done on it).
So in the end the Godot export totally ignore the Python stuff, hence your error :'( But as you saw, you can fix it by manually adding the Python stuff back into the export folder :smiley:
[^1]: Python is more complicated than that and it's possible to tweak it to load modules from basically anywhere, but it's a rabbit hole not really relevant to the current issue, so I cut it simple here ^^
https://github.com/touilleMan/godot-python/assets/117280480/9c468c55-30ee-4a86-bf99-17485fa9044c