For anyone finding this thread later by Google, an update on the Python approach:
I've found an example of the problems that the documentation describe, where you can't issue and wait for multiple batches of G-Code commands within a Python remap. If I execute the remapped G-Code from the MDI, the code I wrote above works. If I execute the remapped code from 100.ngc which I trigger from an Axis UI button, then I get an error:
Code:
self.execute("G38.3 X1 F10")
yield INTERP_EXECUTE_FINISH
print(5070, self.params[5070])
# The execute() below works, if M400 executed from the MDI UI
# The execute() below raises the following, if M400 executed from 100.ngc, triggered from an Axis UI button:
# emc/task/emctask.cc 69: interp_error: exception during generator call: Traceback (most recent call last):
self.execute("G0 X-0.25")
So, I guess I'll do this in plain old G-Code.