Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

start python script in new tmux session #491

Kolvir73 started this conversation in General
Discussion options

Is it possible using libtmux to create a new session and then run a script in it from another python script?

Ideally, in a python program, I'd like to start a new tmux session, rename it, run 'python3 script.py' and then detach it.
I see how I can start the new session, but am missing how to run 'python3 script.py', which really is just a shell command.
Can it be done with server.cmd() somehow? I have experimented with it some without success and will work on it more, but wanted to know if it was even possible.

You must be logged in to vote

Replies: 1 comment

Comment options

Hi and welcome!

Does Pane.send_keys work (source, docs)?

pane = session.attached_window.attached_pane

pane.send_keys('python3 ./script.py', enter=True)
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.