I'm trying to test some M codes in MDI without much luck.  M codes that trigger outputs seem to work fine, but anything to create motion does not work.  See code below.  I tried all of the code execute functions with no luck.  The function is running because last error is updating correctly, just not getting an movement.  If I hit run in the editor, it runs fine.  If I step through the code it runs fine.  It does not work by typing M101 in MDI or by calling M101 in a Gcode file.  The file name is m101.mcs.  What could be wrong to make it run fine in the editor and fail in MDI and gcode?
function m101()
    ---------------------------------------------------------------------
    -- GoTo Safe Z
    ---------------------------------------------------------------------
    inst = mc.mcGetInstance()
    mc.mcCntlSetLastError(inst, 'Move to SafeZ')
    local SafeZ = scr.GetProperty('droSafeZ', 'Value')
    local CodeLine1 = 'G00 Z' .. SafeZ
    mc.mcCntlGcodeExecute(inst, CodeLine1)
    --mc.mcCntlMdiExecute(inst, CodeLine1)
    --mc.mcCntlGcodeExecuteWait(inst, CodeLine1)
end
if (mc.mcInEditor() == 1) then
 m101()
end