Hello all I'm trying to build a script for Prefect...
# prefect-community
p
Hello all I'm trying to build a script for Prefect orchestration wherein my functions are defined in different scripts and imported as modules. All using Python. Is this possible? I've tried the following but I'm getting an error as below: Function_A script:
def func_a():
do something
Function_B script:
def func b():
do something
Prefect script:
from Function_A import func_a
from Function_B import func_b
@task
def executing_func_a():
func_a()
@task
def executing_func_b():
func_b()
.....flow register.....
Flow registers successfully. When executing flow, received an error: ModuleNotFoundError("No module named _func_a")_ Please advise.
r
import Function_A    ..    Function_A.func_a() I believe it needs the module loaded to pickle it
p
Hey @Rob Fowler, thanks for your response. I've tried your suggestion, but am unable to make it run. I still get the same ModuleNotFoundError.
My agent was initiated in a different folder from my modules, and so it was unable to find the required modules. Hence, the error. Anyway, if anyone stumbles across this error, this SO link is useful: https://stackoverflow.com/questions/63881231/prefect-modulenotfounderror-when-running-from-ui
upvote 3