Do you still get the error if you delete: dialogName = “pingMainYesNo” from when you construct it?

It looks like DirectDialog works slightly differently than other DirectObjects. The dialog name you give is a unique name. This means that panda is keeping a global list of all dialogs used. When you create a dialog box, it checks to see if the unique name exists (destroy does not remove the entry). If it finds one, it will cleanup the object, then create the new one. Calling cleanup is like destroy, it will give an error on an allready removed DirectGuiWidget.

So there are two solutions:

1: call myBox.cleanup() instead of destroy. This removes the object and clears out the unique reference to the dialog name.
2: Don’t even call destroy or cleanup. The dialog will be automatically removed. This is probably not the way to go, as you have to wait for the new one before the original is removed.

right so when you use destroy() on the direct dialog, it still keeps the name in some global variable. Python would then keep a pointer to the ‘destroyed’ object, which you don’t want. I asked to remove the name to check that, since DirectDialog generates its own unique name for each instance. But thats not the fix. You would still generate another dialog each time you restart the game, using up memory.

basically call cleanup() instead of destroy() and it should work fine (what zpavlov said).