Background Jobs

Hey guys
I want to run my functions in background even if the document will be closed, for that i am using background jobs but when i import
from frappe.jobs.background_jobs import enqueue
and use def long_job() function in .py it gives import error → No module named ‘frappe.jobs’
any help will be highly appreciatable

You have file hooks.py, there you can configure job your functions will execute every n minutes.
There
image
For example there I point the path for function(function name all or daily)

please share your code and traceback

You need to import properly @Owais_Zafar

from frappe.utils.background_jobs import enqueue

then you can use enqueue method

enqueue(method, queue='default', timeout=None, event=None,
	is_async=True, job_name=None, now=False, enqueue_after_commit=False, **kwargs)

for more details

1 Like

i want to execute a custom method send_email in enqueue … can i do that ?? i want to run a custom method in backgroud … is it possible to call just a method in enqueue ??@Sagar_Bhogayata