I put the code in the load script for the function but that did not help.
Here is the clicked script for the button
--Single Surface Measure Y button
--PRIVATE
--from Y probe button
inst = mc.mcGetInstance()
local profile = mc.mcProfileGetName(inst)
local path = mc.mcCntlGetMachDir(inst)
package.path = path .. "\\Modules\\?.lua;" .. path .. "\\Profiles\\" .. profile .. "\\Modules\\?.lua;"
--Master module
package.loaded.MasterModule = nil
mm = require "mcMasterModule"
--Probing module
package.loaded.Probing = nil
local prb = require "mcProbing"
local ypos = scr.GetProperty("droSurfYPos", "Value")
--local work = scr.GetProperty("ledSetWork", "Value") removed by kfc below line added to stop fixture setup
local work = nil
prb.SingleSurfY(ypos, work)
rc = mc.mcCntlGCodeExecuteWait(inst, "G0 X-5.0") --This is the standard function call for executing gcode. it waits for motor feedback before continuing in the file.
mm.ReturnCode(rc)
prb.SingleSurfY(ypos, work)
Now it probes one time then gets to the gcode line and says an error occurred with a nil value
Not sure how to make progress here.