Hey all, I'm Aviad, new to prefect. I have expensi...
# ask-community
a
Hey all, I'm Aviad, new to prefect. I have expensive initialization process so I want to use
prefect.serve
in my process to reuse the initialization for all flows. however I see that prefect instead of running the flow in my process generates a child process...
Copy code
if __name__ == "__main__":
    load_dotenv()
    GLOBAL_OPTIONS.update_options_from_env()

    handle_stream_end: prefect.Flow
    flows: List[prefect.Flow] = [handle_stream_end]  # list of flows this process can handle
    deployments = [flow.to_deployment("process_deployment") for flow in flows]
    prefect.serve(*deployments)  # serve all flows
is this by design? whats the best way to provide the initialization code for my flows? is there a way to reuse the initialization across multiple flows?