Godot calls function but also throws "Can't call non-static function" error

Godot Version



Hi, I am trying to get my head around classes in Godot and wrote some code which works… but Godot is still throwing the error “Can’t call non-static function ‘reset_button’ in script”. My question would be: Is the error a false interpretation by Godot or am I understanding something wrong?

I have two scripts:

  1. PlayerSkill (class_name), which is a simple scene with a button and a cooldown timer and a function “cooldown_reset”.
  2. CombatDebug, an autoloaded debug script which holds an array of PlayerSkills and resets all of them when a button is pressed.
class_name PlayerSkill
extends Node

@onready var player_skill_button = $"."

func _ready():	

func reset_button():
	player_skill_button.disabled = false
	texture_progress_bar.value = 0

Snippet of the autoloaded debug script

var cooldown_actions = [PlayerSkill]
func cooldown_reset():
	# for all PlayerSkills -> reset
	for action in cooldown_actions:

Now this works like a charm, but the error irritates me and I dont want to continue bad practises or error prone code. Thanks in advance :slight_smile:

There is not enough info to tell, could you show where you call cooldown_reset?

They seem to have made two posts by accident. The more popular thread is here

Oh, nice and they found the issue, cool. And that makes sense.