Setting terminal title from within python

Hi everyone,

I know the following commands can set the title of the terminal window:
unset PROMPT_COMMAND
echo -en “\033]2;$1\007”
However they do nothing if I call them from python using the commands module.
Is there a way to enable my console python scripts to change the title of the terminal they are running in?

 

 

I didn’t find the right solution from the internet.
References:

https://bbs.archlinux.org/viewtopic.php?id=85567

product launch