EDIT: I solved my code as evidenced in this post - Some Python-Based script to make G'MIC scripting easier - #6 by Reptorian
EDIT: I solved my code as evidenced in this post - Some Python-Based script to make G'MIC scripting easier - #6 by Reptorian