79659866

Date: 2025-06-10 06:09:32
Score: 0.5
Natty:
Report link

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.

Fix:

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

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): When
  • Low reputation (1):
Posted by: Niral Ajmera