Fill in foreground color absolutely .
application = Krita.instance()
window = application.activeWindow()
view = window.activeView()
currentBlend = view.currentBlendingMode()
kritaEraserAction = application.action("erase_action")
eraseCheck = kritaEraserAction.isChecked()##TorF
kritaEraserAction.setChecked(False)
view.setCurrentBlendingMode("normal")
application.action('fill_selection_foreground_color').trigger()
# back to pre-setting
kritaEraserAction.setChecked(eraseCheck)
view.setCurrentBlendingMode(currentBlend)
Krita erases the canvas when the (‘fill_selection_foreground_color’) action is performed if the current pen is in erase mode. However, switching pens to perform a fill can be tedious. This script allows you to always fill with foreground color no matter what setting you have your pen set to.