I can make a buffer dedicated to a frame using the following snippet I got from other posts
(defun toggle-window-dedicated ()
"Toggle whether the current active window is dedicated or not"
(interactive)
(message
(if (let (window (get-buffer-window (current-buffer)))
(set-window-dedicated-p window (not (window-dedicated-p window))))
"Window '%s' is dedicated"
"Window '%s' is normal")
(current-buffer)))
(global-set-key (kbd "C-c d") 'toggle-window-dedicated)
Now from from another frame if I want to switch to the dedicated buffer then a copy of the buffer is opened. This is not the behavior I want. I want the focus to switch to the dedicated frame. The solution posted here : switch-to-buffer does not work.