Question regarding "roguelike card game tutorial" (Beginner)

Godot Version

v4.3

Question

at 33:30 in the video he has an error regarding a “method set_text on null value”. He solved it by changing the order of the add_child and the set_card_value.

I get a different error now: Nonexistent function ‘set_card_value’ in base 'Node2D (Card).

First I have created the var with @onready and then i set the function set_card_value with func _ready():

It looks exactly the same as his code.

did something changed in the last months? he does not show what version he uses but it is recent.

Edit: It is not relevant to the project as he later sets up the cards individually anways but i am still curious why it does not work for me.

can you show your Card-script?

class_name Card extends Node2D

@export var card_name: String = “Card Name”
@export var card_description: String = “Card Description”
@export var card_cost: int = 1
@export var card_image: Sprite2D
@export var card_type: String = “Type”

@onready var cost_label: Label = $CostDisplay/CostLabel
@onready var name_label: Label = $CardName/NameLabel
@onready var description_label = $CardDescription/DescriptionLabel
@onready var type_label = $Type/TypeLabel

func _ready():
set_card_values(card_cost, card_name, card_description, card_type)

And the function on button press is:
card.set_card_value(3, “cool card”, “cooldescription”, “test card”)

but theres no method called “set_card_values”