Error Failed to get method for command some_app.dev.doctype.doctype_name.doctype_name.upload2 has no attribute upload2
But when I call this function from bench console
by
bench --site my_site execute some_app.dev.doctype.doctype_name.doctype_name.upload2
everything is okay