0 votes

Can Godot get a function or get a variable from a python script?

in Engine by (12 points)

1 Answer

0 votes

Python is not a natively-supported language in Godot. There are ways to communicate with it but it will be harder than using GDScript, C or C#.

I wrote a similar answer in an older post: https://godotengine.org/qa/50247/how-can-i-use-godot-as-machine-learning-environment?show=50247#q50247

Either use the Python binding made by TouilleMan, or use a system call to invoke the script (like a shell command would do), use C# to embed IronPython, or make your python system run on its own and communicate with network socket.

Note that if your code involves library dependencies, some of these solutions won't work if their python runtime doesn't have access to them.

by (28,962 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.