List of sub-workflows
This is, of course , inspired by the question "List of workflows"
I wondered if it would be possible to obtain the list of all sub-workflows in the different main workflows, e.g. :
Although this would help me keeping organized (some workflows are used as sub-workflows in more than one other workflow), this is, alas, far beyond my competences…
Thanks in advance
Something like this should work for common cases. It won't show sub-workflows within sub-workflows though, just sub-workflows that are embedded directly.
#coding: utf-8 import workflow import editor import os import json cmd_path = os.path.join(editor.get_workflows_path(), 'Commands.edcmd') with open(cmd_path, 'r') as f: workflows = json.load(f) for wf_info in workflows: print wf_info['title'] with open(wf_info['filename'], 'r') as wf_file: wf = json.load(wf_file) actions = wf['actions'] for a in actions: if a['class'] == 'WorkflowActionRunSubWorkflow': sub_wf_name = a['parameters']['workflow'].get('name') print '...', sub_wf_name
Thank you very much for your answer.
It works, of course, beautifully.