https://flyte.org logo
#ask-the-community
Title
# ask-the-community
a

Aphra Bloomfield

11/16/2022, 5:38 PM
Is it possible to import tasks from their own Python modules to get separation of concerns? I have tried this, but get import errors when deploying my workflows.
y

Yee

11/16/2022, 6:59 PM
what are the errors?
a

Aphra Bloomfield

11/16/2022, 8:43 PM
ModuleNotFoundError: No module named 'helpers'
@Yee Nothing works unless I have all of my code in one file, which is not ideal
y

Yee

11/16/2022, 9:03 PM
can you do a ls -R . on the root directory?
it should work. we import tasks all the time from different folders
is
helpers
at the root level of the project?
and do you have init files in all the intermediate folders?
a

Aphra Bloomfield

11/17/2022, 12:14 AM
After some messing around, I realized I was missing an
__init__
file in my main package
Now I’m more wondering about how to handle Promise resolution when running a task within a task
y

Yee

11/17/2022, 1:01 AM
tasks were kinda meant to be the atomic unit of work in flyte. if you want to call one task from another, maybe use a dynamic task?
a

Aphra Bloomfield

11/17/2022, 6:14 PM
Ah, perfect! I thought the concept of “dynamic” was reserved for workflows given the title of this doc.
@dynamic
tasks/workflows let us model our workflows using this pattern of composition