"Attempt to spawn multiple ShowBase instances!"

I’m doing a simple to code that is a “animation” for the game Toontown. I finished the code, cleaned it up, but when i ran it, this error appeared.

 "Attempt to spawn multiple ShowBase instances!"

This is the full code:

from panda3d.core import loadPrcFile

if __debug__:
    loadPrcFile("config/config.prc")

from direct.actor.Actor import Actor
from pandac.PandaModules import *
from direct.task import Task
import math
from math import pi, sin, cos
from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from pandac.PandaModules import Point3
from pandac.PandaModules import *
from direct.interval.ActorInterval import ActorInterval
from direct.interval.IntervalGlobal import *

import direct.directbase.DirectStart
from panda3d.core import CollisionTraverser, CollisionNode
from panda3d.core import CollisionHandlerQueue, CollisionRay
from panda3d.core import Filename, AmbientLight, DirectionalLight
from panda3d.core import PandaNode, NodePath, Camera, TextNode
from panda3d.core import Vec3, Vec4, BitMask32
from direct.gui.OnscreenText import OnscreenText
from direct.actor.Actor import Actor
from direct.showbase.DirectObject import DirectObject




class MyApp(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)
        self.loadModels();
        self.sky = self.loader.loadModel('phase_3.5/models/props/TT_sky')
        self.sky.reparentTo(self.render)
        self.ttc.setTransparency(TransparencyAttrib.MBinary, 1)
        self.oobe()
        self.loadToon()
        self.loadCog()
        self.body.setPosHprScale((-16.30, 0, 0), (270, 0, 0), (1, 1, 1))
        TWalk1 = self.body.posInterval(2.0, Point3(4, 0, 4))
        TWalk2 = self.body.posInterval(2.0, Point3(40, 0, 4))
        Tturn1 = self.body.hprInterval(4.0, Vec3(90, 0, 0))
        Tturn2 = self.body.hprInterval(4.0, Vec3(-90, 0, 0))
        Walk = self.Cog.actorInterval('normalwalk', duration=4, loop=1)
        TWalkA = self.body.actorInterval('Walk', duration=4, loop=1)
        TConked = self.body.actorInterval('conked', duration=2)
        Ttaunt = self.body.actorInterval('Taunt', loop=1, duration=4.5)
        Walk1 = self.Cog.posInterval(4.0, Point3(100, 0, 4))
        Turn1 = self.Cog.hprInterval(.3, Vec3(80, 0, 0))
        Walk2 = self.Cog.posInterval(4.0, Point3(45, 0, 4))
        Swing1 = self.Cog.actorInterval('clubswing', startFrame=0, endFrame=120)
        Victory = self.Cog.actorInterval('CogVictory', startFrame=0, endFrame=40)
        oof = self.body.actorInterval('Slip')
        GetHit1 = self.body.posInterval(.4, Point3(10, 0, 4))
        self.Pace = Sequence(
            TWalk1, TWalk2,
            Parallel(TWalkA, Tturn1, Tturn2, Walk1),
            Wait(.01),
            Turn1,
            Parallel(TConked, Victory),
            Parallel(Ttaunt, Walk, Walk2),
            Parallel(Ttaunt, Swing1),
            Parallel(oof, GetHit1)
        )
        self.Pace.start()
        self.music = None
        self.accept("a", self.startMusic)
        self.accept("q", self.stopMusic)

    def loadModels(self):
        self.ttc = loader.loadModel('phase_15/hood/toontown_central')
        self.ttc.reparentTo(self.render)

    def loadToon(self):

#Body
        legs = Actor('phase_3/models/char/tt_a_chr_dgm_shorts_legs_1000')
        torso = Actor('phase_3/models/char/tt_a_chr_dgm_shorts_torso_1000')
        head = Actor('phase_3/models/char/tt_a_chr_dgm_skirt_head_1000')
        back = torso.find('**/def_joint_attachFlower')
        botHead = head.find('**/head-front')
        topHead = head.find('**/head')
        self.body = Actor({'legs':legs, 'torso':torso, 'head':head},
                          {'legs':{'Static': 'phase_3/models/char/tt_a_chr_dgm_shorts_legs_1000','Idle': 'phase_3/models/char/tt_a_chr_dgm_shorts_legs_neutral',
                            'Run':'phase_3/models/char/tt_a_chr_dgm_shorts_legs_run','Taunt':'test/tt_a_chr_dgm_shorts_legs_taunt.bam',
                            'Angry': 'phase_3.5/models/char/tt_a_chr_dgm_shorts_legs_angry','Walk':'phase_3.5/models/char/tt_a_chr_dgm_shorts_legs_walk',
                            'conked':'phase_3.5/models/char/tt_a_chr_dgm_shorts_legs_conked','Slip':'ttr models/phase_4/models/char/tt_a_chr_dgm_shorts_legs_slip-backward'},
                          'torso':{'Static': 'phase_3/models/char/tt_a_chr_dgm_shorts_torso_1000','Idle': 'phase_3/models/char/tt_a_chr_dgm_shorts_torso_neutral','Run':'phase_3/models/char/tt_a_chr_dgm_shorts_torso_run',
                            'Taunt':'test/tt_a_chr_dgm_shorts_torso_taunt.bam','Angry':'phase_3.5/models/char/tt_a_chr_dgm_shorts_torso_angry','Walk':'phase_3.5/models/char/tt_a_chr_dgm_shorts_torso_walk',
                            'conked':'phase_3.5/models/char/tt_a_chr_dgm_shorts_torso_conked','Slip':'ttr models/phase_4/models/char/tt_a_chr_dgm_shorts_torso_slip-backward'},
                           'head':{'Idle':'phase_3/models/char/tt_a_chr_dgm_skirt_head_neutral',
                            'Run':'phase_3/models/char/tt_a_chr_dgm_skirt_head_run','Static':'phase_3/models/char/tt_a_chr_dgm_skirt_head_1000',
                            'Taunt':'test/tt_a_chr_dgm_skirt_head_taunt.bam','Angry':'phase_3.5/models/char/tt_a_chr_dgm_skirt_head_angry','Walk':'phase_3.5/models/char/tt_a_chr_dgm_skirt_head_walk',
                            'conked':'phase_3.5/models/char/tt_a_chr_dgm_skirt_head_conked','Slip':'ttr models/phase_4/models/char/tt_a_chr_dgm_skirt_head_slip-backward'}})
        self.body.attach('torso', 'legs', 'joint_hips')
        self.body.attach('head', 'torso', 'def_head')
        self.body.reparentTo(self.render)
        self.body.loop('Static')
        self.body.find('**/head-front').setColor(0, 0.8, 0.6)
        self.body.find('**/head').setColor(0, 0.8, 0.6)
        self.body.find('**/neck').setColor(0, 0.8, 0.6)
        self.body.find('**/arms').setColor(0, 0.8, 0.6)
        self.body.find('**/legs').setColor(0, 0.8, 0.6)
        self.body.find('**/feet').setColor(0, 0.8, 0.6)
# Shoes
        Shoes = loader.loadTexture('ttr models/phase_4/maps/tt_t_chr_avt_acc_sho_workBoots.jpg')
        self.body.find('**/shoes').setTexture(Shoes, 1)
        self.body.find('**/boots_long').hide()
        self.body.find('**/boots_short').hide()
        self.body.find('**/feet').hide()
# Hat
        self.Hats = loader.loadModel('phase_4/models/accessories/tt_m_chr_avt_acc_hat_golfHat')
        self.Hats.reparentTo(self.body.find('**/head'))
        self.Hats.setPosHprScale((0.0, -0.048714, 0.46431), (180.0, 323.130096, 0.0), (0.318405, 0.318405, 0.318405))
        self.Hats.setColor(0.99, 0.99, 0.99)

# Glasses
        self.Glasses = loader.loadModel('phase_4/models/accessories/tt_m_chr_avt_acc_msk_squareRims')
        self.Glasses.reparentTo(self.body.find('**/head-front'))
        self.Glasses.setPosHprScale((0, .16996, .309818), (180, 3.814075, 0), (.265522, .220048, .277431))
        self.Glasses.setColor(0.99, 0.99, 0.99)

#Backpack
        self.Backpack = loader.loadModel('phase_4/models/accessories/tt_m_chr_avt_acc_pac_gags')
        self.Backpack.reparentTo(self.body.find('**/def_joint_attachFlower'))
        self.Backpack.setPosHprScale((0.227545, -1.05, 0.053624), (180.0, 6.0, 0.0), (0.319532, 0.319532, 0.319532))

# Luvas/Gloves
        self.Gloves = self.body.find('**/hands')
        self.Gloves.setColor(0.99, 0.99, 0.99)

# Mangas/Sleeves
        Sleeves = loader.loadTexture('ttr models/phase_4/maps/tt_t_chr_avt_shirtSleeve_bee.jpg')
        self.body.find('**/sleeves').setTexture(Sleeves, 1)

# Camisas(camisetas)/Shirts
        Shirt = loader.loadTexture('ttr models/phase_4/maps/tt_t_chr_avt_shirt_bee.jpg')
        self.body.find('**/torso-top').setTexture(Shirt, 1)

# Shorts (its the same in my language)
        Shorts = loader.loadTexture('ttr models/phase_4/maps/tt_t_chr_avt_shorts_playTime.jpg')
        self.body.find('**/torso-bot').setTexture(Shorts, 1)

# Sombra do Toon/Toon Shadow
        self.Shadow = loader.loadModel('phase_3/models/props/drop_shadow.bam')
        self.Shadow.reparentTo(self.body.find('**/joint_shadow'))
        self.Shadow.setScale(.45)
        self.Shadow.setColor(0, 0, 0, .5)
        self.Shadow.setBin('fixed', 0, 1)

    def loadCog(self):
        self.Cog = Actor('phase_3.5/models/char/suitA-mod', {'fingerwag': 'ttr models/phase_5/models/char/suitA-fingerwag',
                                                        'weirdwalk': 'ttr models/phase_5/models/char/suitA-awalk',
                                                        'normalwalk': 'ttr models/phase_4/models/char/suitA-walk',
                                                        'clubswing': 'ttr models/phase_5/models/char/suitA-golf-club-swing.bam',
                                                        'CogVictory': 'ttr models\phase_4\models\char/suitA-victory'})
        self.Cog.reparentTo(self.render)
        self.Cog.loop('normalwalk')
        self.CogHead = loader.loadModel('ttr models/phase_4/models/char/suitA-heads.bam').find('**/bigcheese')
        self.CogHead.reparentTo(self.Cog.find('**/joint_head'))
        self.Cog.setPosHprScale((215.71, 37.24, 4), (180, 0, 0), (16, 16, 16))
        self.Icon = loader.loadModel('ttr models/phase_3/models/gui/cog_icons').find('**/CorpIcon')
        self.Icon.reparentTo(self.Cog.find('**/joint_attachMeter'))
        self.Icon.setH(180)
        self.Cog.setPosHprScale((102, 46, 4), (180, 0, 0), (1, 1, 1))
        self.Shadow = loader.loadModel('phase_3/models/props/drop_shadow.bam')
        self.Shadow.reparentTo(self.Cog.find('**/joint_shadow'))
        self.Shadow.setScale(.45)
        self.Shadow.setColor(0, 0, 0, .5)
        self.Shadow.setBin('fixed', 0, 1)
        self.club = loader.loadModel('phase_5/models/props/golf-club.bam')
        self.club.reparentTo(self.Cog.find('**/joint_Lhold'))

    def startMusic(self):
        if self.music:
            self.music.stop()
            self.music.play()
        else:
            self.music = self.loader.loadMusic('phase_3/audio/bgm/create_a_toon.mid')
            self.music.play()

    def stopMusic(self):
        self.music.stop()

app = MyApp()
app.run()

Remove the DirectStart import. Also, remove the extra PandaModules imports. These are not necessary because you respectively already use ShowBase and panda3d.core.

Thanks, the code works now! :smiley: