Please consider the toy code here:
CreatePalette[DynamicModule[{var},
Button["Generate Random Number", randstuff[var],
ImageSize -> Medium, Method -> "Queued"]],
{Initialization -> (randstuff[var_] := DynamicModule[{},
Print[RandomReal[]]]);
WindowTitle -> "toy palette"}
];
If you run the code above and press the "Generate Random Number", you will see a random number printed in the Messenges notebook that pops up. Everything seems to be ok.
Then, if you install this notebook, quit the kernel and select the newly installed palette from the Palettes drop-down menu, the Generate Random Number button no longer works.
A. Why does the code fail to execute properly when it is run from an installed palette notebook?
B. Since Mathematica essentially does nothing (from the installed palette), how does one troubleshoot (debug) behavior like this?
Thanks for reading.