I guess the only way to achieve that is using python scripting.
How did you came up with “freehand_brush”? After running:
[print([a.objectName(), a.text()]) for a in Krita.instance().actions()]
copying the output somewhere and doing ctrl+f, you get the “erase_action”, but freehand brush is called “KritaShape/KisToolBrush”.
I would also change the order to make sure the eraser action is changed after changing the tool, so the whole code should be:
from krita import *
Krita.instance().action("KritaShape/KisToolBrush").trigger()
eraseAction = Krita.instance().action("erase_action")
if (eraseAction.isChecked()):
eraseAction.trigger()
This Ten Script dialog is something that makes it unusable in my opinion, and I wonder why it haven’t be removed so far. You can avoid it by making a proper krita extension out of the script. You can find out how to do it in krita manual or downloading my extension - wojtrybExtension.zip contains 4 actions like this, you only need to add one, and there is a manual how to turn it on there.