Unable to set route to kanban view

I have posted this in the frappe forum. Please forgive the cross posting

I have a custom doctype which has a status field and I have created an associated Kanban view
When I view the Kanban view of my doctype manualy it works fine.

I have added 2 buttons to another form to show list and kanban views of my doctype

This one works fine and I see the list view
frm.add_custom_button(__(“Production View”), function() {
frappe.route_options = {“mydoctype”: frm.doc.name};
frappe.set_route(“List”, “My Doctype”, “List”);
});

This one does not. It only shows me the regular list view until I click the back button

frm.add_custom_button(__(“Kanban Production View”), function() {
frappe.route_options = {“mydoctype”: frm.doc.name};
frappe.set_route(“List”, “My Doctype”, “Kanban”, “My Doctype Kanban View”);
});

Try
frappe.set_route("List", "Doctype", "Kanban", "Kanban_name");

Hello Shahid

Thank you for replying.
How is
frappe.set_route(“List”, “Doctype”, “Kanban”, “Kanban_name”);
different from
frappe.set_route(“List”, “My Doctype”, “Kanban”, “My Doctype Kanban View”);

There is nothing wrong with your code. What is the version of Frappe you are using?

@MarZah sorry, i thought you were entering wrong kanban_name,
your code should work because it is working in my case,
you must be doing something wrong, share your complete code of kanban button with original fields and doctype name.
or alternate way is :
window.open("https://www.google.com","_self");
replace above google url with the complete url of your kanban.