Actors and functions?

:astonished:
If I run this I dont see any animation:

import direct.directbase.DirectStart
from pandac.PandaModules import *
from direct.actor.Actor import Actor

def myFunc():
	
	model = loader.loadModel('panda')
	#model.reparentTo(render)
	
	actor = Actor(model)	
	actor.reparentTo(render)
	actor.loadAnims({'anim': 'panda-walk'})
	actor.loop('anim') 

myFunc()

run()

[/code]
But it works when I run it without a function

import direct.directbase.DirectStart
from pandac.PandaModules import *
from direct.actor.Actor import Actor
	
model = loader.loadModel('panda')
#model.reparentTo(render)

actor = Actor(model)	
actor.reparentTo(render)
actor.loadAnims({'anim': 'panda-walk'})
actor.loop('anim') 

run()

I’ve spent the last 3 (4?) hours trying to find this issue. What’s going on?

try calling run() before myFun()

Um, that definitely won’t work.

@Anon

From the manual:

Woah, never encountered that issue.
Thanks