How to test if a variable is undefined
MaxScript
if DavesMagicTool == undefined do DavesMagicTool = DavesToolOfJoy()
Python
if not ('DavesMagicTool' in globals()): DavesMagicTool = DavesToolOfJoy()