Is it possible to import tasks from their own Pyth...
# ask-the-community
a
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
what are the errors?
a
ModuleNotFoundError: No module named 'helpers'
@Yee Nothing works unless I have all of my code in one file, which is not ideal
y
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
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
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
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
104 Views