The code of select_pane is:
if target_pane in ["-l", "-U", "-D", "-L", "-R"]:
proc = self.cmd("select-pane", "-t%s" % self.window_id, target_pane)
else:
proc = self.cmd("select-pane", "-t%s" % target_pane)
If calling it with a pane index (e.g. window.select_pane(3)) the resulting command will be select-pane -t3. This will result in self.server.cmd('select-pane -t3').
=> It will always change the pane in the session number 1.
Shouldn't there be some kind of further target description like
select-pane -t $3:@9.3 (change to pane 3 in session 3, window9)
?