Importing module within the celery task

I wonder whether there could be difference between the following code snippets

from some_module.sub_module import some_function
@app.task(soft_time_limit=16, time_limit=18)
def call_function():
    some_function()

and

@app.task(soft_time_limit=16, time_limit=18)
def call_function():
    from some_module.sub_module import some_function
    some_function()

I'm using celery with Django and there are around 16 celery processes. Is there some difference between th abovementioned pieces of the code? I feel like there can be some difference. What if inside some_module.sub_module module there is a variable? Will all workers share it? Or absolutely everything is separated?

Thank you.

Back to Top