Error, attribute does not exist.

# To change this template, choose Tools | Templates
# and open the template in the editor.
from direct.task import Task
import math
from direct.showbase.ShowBase import ShowBase
from panda3d.core import *
from direct.actor.Actor import Actor
from direct.interval.IntervalGlobal import *

from direct.gui.OnscreenText import OnscreenText
from pandac.PandaModules import loadPrcFileData
from panda3d.core import Vec3
from direct.gui.OnscreenImage import OnscreenImage

class Application(ShowBase):

    def __init__(self):
        ShowBase.__init__(self)

        self.dude = mainDude()
        
        self.taskMgr.add(,self.addGround,   "addground")
        self.frames = 0
        
        self.block = None
        
        def isWhole(self,  x):
            if(x%1 == 0):
                return True
            else:
                return False
        
        def addGround(self,  task):
            if self.isWhole(self.frames/4):
                self.block.removeNode()
                self.block = loader.loadModel("block")
                self.block.reparentTo(render)
            return task.cont
        
class mainDude(object):
        def __init__(self):
            self.load()
            
        def load(self):
            self.smiley = loader.loadModel("smiley")
            self.smiley.reparentTo(render)
            self.smiley.setPos(0,  0,  0)
            
            

And it says attribute error, addground does not exist. what am I doing wrong?

Hi! :slight_smile:

The method addGround is misindented.

I think that you’ll find that the method “isWhole” is also mis-indented.