Why to define self?

Why to define self?

"self’ is merely a commonly used name for the class instance variable, you can call it anything you want. You only need it to access the current class instance within a class method.

Yes but I still have problems whit the game:

import direct.directbase.DirectStart
from direct.task import Task 
from direct.actor import Actor
from pandac.PandaModules import * 
import sys





#Load the first environment mode
environ = loader.loadModel("models/ssw1.egg")
environ.reparentTo(render)
environ.setScale(0.25,0.25,0.25)
environ.setPos(0,0,0)

#Load the first environment mode
environ = loader.loadModel("models/rr2.egg")
environ.reparentTo(render)
environ.setScale(0.25,0.25,0.25)
environ.setPos(0,0,0)

#base.disableMouse()


ssw1 = loader.loadModel("models/ssw1.egg")

player = ssw1 

dummy=render.attachNewNode("models/ssw1.egg") 
base.camera.reparentTo(dummy) 
dummy.setPos(0,30,0) # 10 = distance between cam and point 
dummy.setH(0) #this will rotate it 60 degrees around the point

base.cam.lookAt(ssw1)


nodePath = Actor('models/erer', {'er':'models/er.egg'})
setPos(1,1,1)
reparentTo()

 

run()
DirectStart: Starting the game.
Known pipe types:
  wglGraphicsPipe
(all display modules loaded.)
Traceback (most recent call last):
  File "new3.py", line 38, in <module>
    nodePath = Actor('models/erer', {'er':'models/er.egg'})
TypeError: 'module' object is not callable

Change this import line:

from direct.actor import Actor

into this:

from direct.actor.Actor import Actor

Yes it is work.