https://kedro.org/ logo
#questions
Title
# questions
e

Eluard Camota

09/07/2023, 12:33 PM
Hi everyone, I'm new here in kedro and saw this video on youtube

https://www.youtube.com/watch?v=fYkVtzXUEBE

. Apparently I'm having an error with the load context.
Copy code
ImportError: cannot import name 'load_context' from 'kedro.framework.context'
m

marrrcin

09/07/2023, 1:00 PM
load_context
is not available anymore in the recent versions of Kedro (I believe it was removed in 0.18.0). Use
after_context_created
hook instead. https://docs.kedro.org/en/stable/hooks/introduction.html#hook-specification
e

Eluard Camota

09/07/2023, 1:07 PM
Is it possible to run the pipeline thru the streamlit.py?
same to what the video is doing, I would like to display the data which will be depending to the input parameters but it needs to run the pipeline everytime the input in the streamlit page is changed
m

marrrcin

09/07/2023, 1:40 PM
Of course, you can just run Kedro directly from any part of Python code:
Copy code
from kedro.framework.session import KedroSession
from kedro.framework.startup import bootstrap_project
from pathlib import Path

# If you are creating a session outside of a Kedro project (i.e. not using
# `kedro run` or `kedro jupyter`), you need to run `bootstrap_project` to
# let Kedro find your configuration.
bootstrap_project(Path("<project_root>"))
with KedroSession.create() as session:
    session.run()
https://docs.kedro.org/en/stable/kedro.framework.session.session.KedroSession.html
Both
create()
and
run()
have some cool arguments you can set at runtime from your streamlit app
e

Eluard Camota

09/07/2023, 2:03 PM
Thanks for your help