Why does frappe.db.exists call raises 'NoneType is not callable' error in a server script?

A piece of code and error message is attached.

But if the call is changed to a if count(frappe.get_all(“DocType Name”, [[“name”, “=”,“39ffaa”]]) it does the trick. The call to frappe.db.exists is elegant in my opinion.

Can you share the entire traceback from the browser console?

One reason you are facing this issue could be that the doc value is None.
Will need the traceback to confirm…