I have tow .py file:
game.py:
from direct.showbase.ShowBase import ShowBase
from direct.actor.Actor import Actor
from ku_fei import *
class MyApp(ShowBase):
def __init__(self):
ShowBase.__init__(self)
self.ku_fei = ku_fei()
app = MyApp()
app.run()
ku_fei.py:
#!/usr/bin/python
#coding:utf8
from direct.fsm.FSM import FSM
from direct.showbase.ShowBase import ShowBase
from direct.actor.Actor import Actor
class ku_fei(FSM):
def __init__(self):#可选,因为 FSM 已经定义了 __init__
FSM.__init__(self, 'ku_fei')
self.a = Actor("./ku-fei",{"walk":"./ku-fei-walk"})
self.a.reparentTo(__builtin__.render) # ERROR !!
But python tell me the builtin is not defined in ku_fei.py last line. I remember __builtin is a global variable.