title: Setting environment variables for the scope of a terminal session in python or bash (or both!)
body: <p>I would like to set environment variables for the scope of a terminal session.</p>
  
  <p>Eg, the user would open a terminal, type something like <code>setproject &lt;project_name&gt;</code> and it would export an environment variable <code>PROJECT</code>.  When they close the terminal, the variable setting is lost. What was impressive with this system was that it would know what project name was valid and what wasn’t. I’ve worked at places that have done this quite well and I’m wondering how it’s done.</p>
  
  <p>I’d prefer the user not have to type <code>source setproject &lt;project_name&gt;</code> and I also wanted to check if the project they specified was valid or not.</p>
  
  <p>I’ve written something in python, which checks the validity of a project name (against a yaml config file), and passes it on to a bash script, but it doesn’t really work (the environment variable isn’t properly set. It’s set, but only for the scope of the python script)</p>
  
  <p>So, how’d I do this? Are there any good examples of what I’m looking for online?</p>