niklas2902 / py4godot

Python scripting for Godot. This GDExtension plugin allows you to use Python like GDScript, accessing the Godot engine's features and benefiting from Python's vast ecosystem.
MIT License
64 stars 7 forks source link

print #84

Open jartiedaacciona opened 2 weeks ago

jartiedaacciona commented 2 weeks ago

maybe is a simple thing but I don't see it. python print doesn't shows as output I see there is a: from py4godot.utils.print_tools import print but looks like it needs some kind of object as parameter. Is there any way to print logs to console? thanks jorge

niklas2902 commented 2 weeks ago

Hey, thank you for submitting this issue. It seems like importing print from print_tools is broken. But you should be able to use print without importing it from print_tools. This code should print hello to the console:

# file: node3d.py
from py4godot.classes import gdclass
from py4godot.classes.Node3D.Node3D import Node3D
@gdclass
class node3d(Node3D):
    def _ready(self) -> None:
        print("hello")

I hope, this helps.