Open file in current session from another terminal window?

My question is similar to this one, but I need a little more help. I’m trying to have a way to open a file in kak from a second tmux pane (and eventually as part of a script to point $EDITOR to) which opens the file and changes the active buffer in a currently running kak session.

At the moment I can put hook global ClientCreate .* %{ rename-client main } in my kakrc and then echo " eval -client main %{ edit \"file\" } " | kak -p <current-session> but this doesn’t seem like an elegant solution (renaming every client ‘main’). Is there a more robust way to do what I want?

It looks like what you want connect.kak to do.

From Kakoune, to open a new connected terminal:

>

Then open files in the client with:

:edit file.txt