Hmm… SeExpr script can be read/write from pykrita, so it almost possible. There is just little Bug in updates (also there is no signal in pykrita for current frame changed?).
Partial answer:
from random import random
from krita import Krita
def color_me_random():
app = Krita.instance()
doc = app.activeDocument()
node = doc.activeNode()
# get old SeExpr
proprties_dct = node.filterConfig().properties()
# overwrite SeExpr script
proprties_dct['script'] = "\n".join([
f"$val = voronoi(5*[$u,$v,.5],4,.6,.2);",
f"$color = ccurve(",
f" $val,0,[{random()}, {random()}, {random()}],",
f" 4,0.185,[{random()}, {random()}, {random()}],",
f" 4,0.301,[0.651,0.447,0.165],",
f" 4,0.462,[0.976,0.976,0.976],4);",
f"$color"])
# apply new SeExpr
node.filterConfig().setProperties(proprties_dct)
doc.refreshProjection()
# before running.
# create new document and add filllayer with SeExpr
# select layer and run following command
color_me_random()
# end result is that script gets replaced
# Bug: Document.refreshProjection() ignores changes to script???