linux – How to change a tmux session created by a script

I'm trying to execute a script that automates the opening of a tmux session and then execute some commands, such as opening some windows and panels, etc.

I tried to use xdotool so I thought it's better to just use tmux and call send keys

#! / bin / bash

SESSIONNAME = "Working" # Set the name of the tmux session
echo "Starting a tmux session"
sleep 2s

if (tmux has-session -t "$ SESSIONNAME" 2> / dev / null); so
echo "Session & # 39; $ SESSIONNAME & # 39; exists."
tmux -u new-session -d -s $ SESSIONNAME
tmux send-keys -t $ SESSIONNAME "echo & hello world & # 39;" ENTER

#tmux a
#tmux send-keys -t $ SESSIONNAME "echo & hello & # 39;" ENTER
exit 0

The problem with this script, the created session is not automatically attached and if I try to call tmux one before running some send keys, these commands do not run at all.

Can you please clarify or guide me a little about how to achieve the goal? Thank you.