When python loads the modules, it doesn't loads main block. Hence when you try to import celery_app in other file, it logs none.
control_plane/app.py
def create_celery(app=None):
# your celery config
return celery
celery_app = create_celery(app)
if __name__ == "main":
print("Celery app initialized::::::::::::::::::", celery_app)
app.run(debug=True)
execution_plane/tasks.py
from control_plane.app import celery_app
from celery.signals import task_prerun, task_postrun
from control_plane.extensions import db
print("Celery app initialized::::::::::::::::::", celery_app)
Now, when you try to import the celery_app in another file, it should work as expected