- is that purely for readability reasons or is there a side effect for using
from prefect import context
that one should be aware of ? (My current intuition/understanding is that there shouldn't be any difference here)
z
Zanie
01/21/2021, 11:57 PM
Hi @Marwan Sarieddine — there shouldn’t be a difference here. I think it’s probably safer to
import prefect
instead of doing
from prefect import context
but I would have to read more about how python populates the module at import-time to know for sure.
Zanie
01/21/2021, 11:58 PM
I do not think I’ve ever seen an issue from using
from prefect import context
m
Marwan Sarieddine
01/22/2021, 12:20 AM
Hi @Zanie thanks for your prompt response - and as far as importing globally vs locally you also see no difference there right ?
z
Zanie
01/22/2021, 12:22 AM
Yep!
a
Alex Papanicolaou
01/22/2021, 1:08 AM
Hi @Zanie This topic came up in a discussion between @Marwan Sarieddine and me and I could have sworn I had read that one had to be careful with the context object. I’m trying to find it and perhaps this is issue is close. It’s obviously very old. https://github.com/PrefectHQ/prefect/issues/1710
z
Zanie
01/22/2021, 1:39 AM
Ah yeah — it is possible that you’ll run into pickling problems. It seems like the error message should be clear if that happens though.
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.