I am trying to set up Bash tab completion inside of a python script but cannot seem to get the completion to persist once the script is over. What I am trying right now is:
from subprocess import call
options = {'option1' : option1,
'option2' : option2}
all_options = string.join(options.keys())
call('complete -W "%s" -f python_cmd' %all_options, shell=True)
Where python_cmd is a python script that takes as its first argument one of the options. After running this script the options will not complete after the command. This works fine if I call the complete command directly from the command line but I need to be able to call it from python. I am guessing that this has something to do with call() ending with the script. Anyone know how I can make this persist after the script has ended?