Custom Button forward to Import Data screen by frappe.set_route?

If I use frappe’s default import data function my url looks like:
url:app/data-import/School%20Year%20Import%20on%202024-03-01%2014%3A30%3A00.594881
Can I customize a button to move to this page instead of going to the Data Import Tool?
I tried frappe.set_route and route_options but it didn’t work

Hi @duynguyen,

Please check and try it.

frappe.ui.form.on('Your DocType', {
    refresh: function(frm) {
        frm.add_custom_button(__('Go to Data Import'), function() {
            frappe.route_options = {
                "reference_doctype": frm.doctype,
                "import_type": "Insert New Records"
            };
            frappe.set_route("Form", "Data Import", 'new-data-import');
        });
    }
});

Please set your doctype in the script.

Thank You!