How do I change an animation in AnimationTree to another using a script?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By IG2

How do I change an animation in AnimationTree to another using a script?
enter image description here

enter image description here

enter image description here
extends AnimationTree

func _ready():
	self.?????

	pass
:bust_in_silhouette: Reply From: spaceyjase
set("parameters/state_machine_name/state_name/blend_2/blend_amount",  0.5)

You can see parameter names by hovering over them in the editor (e.g. Blend Amount); you can copy them by right-clicking a parameter and using the context menu.

I asked how to change animation. AnimationNodeAnimation

enter image description here

Blend2 and other nodes are available in Parameters, but AnimationNode is not there.

enter image description here

IG2 | 2023-01-25 15:34

Not sure why you’d change the animation here; perhaps you mean to use a state machine instead of a blend? The node itself is output only I believe, with just one property of ‘animation’ (which does have a setter).

AnimationNodeAnimation — Godot Engine (stable) documentation in English

spaceyjase | 2023-01-25 20:23