Anyone know how to use animation frames with code?

Godot Version

4.5.1

Question

I just made a shop and it buys and everything but the main thing that I buy doesnt display, I’m using sprite frames to switch items anyone know how to work them?

extends Panel

@export var item: AniData
@export var price: int = 100

@onready var icon = $Icon
@onready var name_label = $Name
@onready var price_label = $Price
@onready var buy_button = $BuyButton


func _ready():
	if item:
		icon.texture = item.Ani_Sprite.get_frame_texture("ear-flick", 0)
		name_label.text = item.Ani_Name
		price_label.text = "$" + str(price)

	buy_button.pressed.connect(buy_ani)


func buy_ani():
	if Currency.spend_money(price):
		display_ani()

func display_ani():
	var companion_box = get_tree().current_scene

	if companion_box.has_method("change_ani"):
		companion_box.change_ani(item)

Somewhere in the world, a kitten gets very very sad each time you type an identifier name using a Pascal_And_Snake_Case_Frankenstein.

As for your problem, you need to describe it better - what is happening vs. what you’re expecting to happen, are there any errors, provide full context etc. Check the help section posting guidelines to see how to formulate your questions to increase the likelihood of getting them answered.