Hi every body !!! Is there any way to separete @ta...
# ask-community
a
Hi every body !!! Is there any way to separete @task in diferent files using github storage? when I try that (new folder, import this file with def with @task decoraction and import of the prefect task …) the output tall me: ModuleNotFoundError: No module named ‘tasks’
a
what agent do you use? the easiest would be if you install your custom code as a package into your execution environment, then you will be able to import it.
this repo contains an example with a demo package called “flow_utilities” - you would need to package your tasks into your package
a
I setup UniversaRun because I have Local and Docker agents
so is best practice build a package to disengage the tasks ?
when you import the flow_utilities … the functions don’t need @task ?
a
it depends on whether you add the task decorator in your packaged function, or whether you just import and call it within a task
a
hummm ok … thanks so much 🙂
I am trying …
I am traying to build module but … dont works … I don know what I am missing …
a
looks like you import the module named “components” but it’s not within your package. Can you check if your imports are specified correctly or if you packaged this module properly?
a
I think maybe will be because the STORAGE just identify main.py ? and components are module in other folder
What I am trying to do are put the tasks individually in separate files becase each task are a little bit complicate After that build a flow that can call this tasks Using github actions and store … and I have the feel maybe that is not posible
a
you can definitely design your flow in such a way that your task’s business logic is defined in some other module rather than directly in the flow. It’s all a matter of packaging it into a python package or a Docker container. Not sure why building a package doesn’t work for you. Perhaps Docker storage will be easier?