I found out how to set user options, so I created a function to automate this:
if [ -n "$TMUX" ]; then
function set_tmux_opt {
tmux set -q "@$1_$TMUX_PANE" "$2"
}
fi
and it's used like this:
set_tmux_opt 'some_variable' '1'
and I get it like this:
function get_tmux_opt {
tmux show -v "@$1_$2"
}
and used like this:
$pane_id="$1
get_tmux_opt 'some_variable' $pane_id
and then passed into the script using `pane_id`