0 votes


I'm starting a project and decided to go ahead and use GDScript. I'm new to the engine and I encountered a problem with the function get_parent(). I checked in the documentation and it is a function of Node, which my class extends.

extends CardBase

class_name CardSummon

const SUMMON_RESOURCE = preload("res://src/Scene/Summon.tscn");

func summonchar():
var NewSummon = self.SUMMON

(Note: CardBase extends Node2D and therefore Node)

The error I got was: "error(9, 1): The method "get_parent" isn't declared in the current class. I don't see how this could be the case, so I'm hoping for some helpful input.

Thanks in advance!

in Engine by (12 points)

Sometimes godot has problems with multiple extensions of classes. I think is some kind of class caching problem.
I my case shutting down and restart godot and open and save the classes does solved the problem.
Have you tried this?

That apparently seems to work, it's pretty strange. Thanks!

Please log in or register to answer this question.

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.