Hi team, can we use imperative workflow as a subwo...
# ask-the-community
Hi team, can we use imperative workflow as a subworkflow? [confirm it is working] However, when I add an imperative workflow inside a helper function, I received the following error:
Copy code
File ".../site-packages/flytekit/core/workflow.py", line 545, in 
raise Exception("Can't already be compiling")
Exception: Can't already be compiling
Sample code:
Copy code
def upload_sources() -> FlyteDirectory:

def helper_func(
    params: str,
    name: str
) -> Workflow:
    test_workflow = Workflow(name=name)
    test_workflow.add_workflow_input("params", str)
    uploaded_sources_node = test_workflow.add_entity(upload_sources)

    return test_workflow(
We want to customize the workflow name for users using imperative workflow. If this doesn't work, do we have any other workaround? cc: @Kevin Su
name is just an attribute.
should be pretty easy to override after the fact.
but when you do test_workflow(…) you’re invoking the workflow. is that what you want to do?
Can we override a normal workflow’s name?
Yeah we want to return the workflow and have the users to call this helper function to customize the workflow’s name
Imperative workflow seems to be customizable
But the serialization will fail at uploaded_sources_node = test_workflow.add_entity(upload_sources)
Found the
oh sorry, hopped off.
yes that is one yes.