Global name 'makeCard' is not defined!

OK. So, let’s get to the point. This code:

from pandac.PandaModules import *
toon = self
head = self.getPart('head')

def makeCard(book=False):
	cardMaker = CardMaker('laughing-man-cm')
	cardMaker.setHasUvs(1)
	cardMaker.setFrame(-0.5, 0.5, -0.5, 0.5)

	nodePath = NodePath('laughing-man')
	nodePath.setBillboardPointEye()

	lmBase = nodePath.attachNewNode(cardMaker.generate())
	lmBase.setTexture(loader.loadTexture('phase_3/maps/lm_base.rgba'))
	lmBase.setY(-0.3)
	lmBase.setTransparency(True)

	lmText = nodePath.attachNewNode(cardMaker.generate())
	lmText.setTexture(loader.loadTexture('phase_3/maps/lm_text.rgba'))
	lmText.setY(-0.301)
	lmText.setTransparency(True)
	lmText.hprInterval(10, (0, 0, -360)).loop()

	lmFace = nodePath.attachNewNode(cardMaker.generate())
	lmFace.setTexture(loader.loadTexture('phase_3/maps/lm_face.rgba'))
	lmFace.setY(-0.302)
	lmFace.setTransparency(True)

	return nodePath


def addHeadEffect(head, book=False):
	card = makeCard(book=book)
	card.setScale(1.45 if book else 2.5)
	card.setZ(0.05 if book else 0.5)
	for nodePath in head.getChildren():
		nodePath.removeNode()
	card.instanceTo(head)


def addToonEffect(toon):
	toon.getDialogueArray = lambda *args, **kwargs: []
for lod in self.getLODNames():
				addHeadEffect(self.getPart('head', lod))

returns THIS error:

NameError: Global name 'makeCard' is not defined

How can i fix this? Keep in mind that i’m replacing the snowman cheesy effect on the Toontown Infinite source to do this.

It may be my insomnia but it looks like this should be part of a class, but isn’t:

toon = self
head = self.getPart(‘head’)

Probably unrelated to fixing your specific issue.

It’s about the makeCard. Those are like a different version of this
def toon():
self
def head():
self.getPart(‘head’)

I would have the see the full file because the code snippits you are posting don’t make sense to me.