Godot is really supposed to be used with nodes, maybe you could separate functionality from the main script to multiple sub nodes. But without knowing more about what your main and character-functions actually do, you could extend nothing instead of extending Resource
, and make the functions static:
# character-functions.gd
static func do_something():
# main.gd
const CHARACTER_FUNCTIONS = preload("res://scripts/character-functions.gd")
func something_else():
CHARACTER_FUNCTIONS.do_something()
This way you won't be instantiating the character-functions.gd
class at all, you are just calling the static functions from it.
If the script functions cannot be static, you should extend RefCounted
instead, since it's the simplest class that does memory management for you (gets freed from memory when no longer in used / in scope). Resource
is the base data-container class, so it's otherwise identical to RefCounted
, except it includes functionality to save itself to the disk. See the When and how to avoid using nodes for everything documentation page for more info about these classes.