title: Boto3 uses old credentials
body: <p>I am using <code>tkinter</code> to create gui application that returns the security groups. Currently if you want to change your credentials (e.g. if you accidentally entered the wrong ones) you would have to restart the application otherwise <code>boto3</code> would carry on using the old credentials.</p>
  
  <p>I'm not sure why it keeps using the old credentials because I am running everything again using the currently entered credentials.</p>
  
  <p>This is a snippet of the code that sets the environment variables and launches <code>boto3</code>. It works perfectly fine if you enter the right credentials the first time.</p>
  
  <pre><code>os.environ['AWS_ACCESS_KEY_ID'] = self.accessKey
  os.environ['AWS_SECRET_ACCESS_KEY'] = self.secretKey
  
  self.sts_client = boto3.client('sts')
  
  self.assumedRoleObject = self.sts_client.assume_role(
      RoleArn=self.role,
      RoleSessionName="AssumeRoleSession1"
  )
  
  self.credentials = self.assumedRoleObject['Credentials']
  
  self.ec2 = boto3.resource(
      'ec2',
      region_name=self.region,
      aws_access_key_id=credentials['AccessKeyId'],
      aws_secret_access_key=credentials['SecretAccessKey'],
      aws_session_token=credentials['SessionToken'],
  )
  </code></pre>
  
  <p>The credentials variables are set using:</p>
  
  <pre><code>self.accessKey = str(self.AWS_ACCESS_KEY_ID_Form.get())
  self.secretKey = str(self.AWS_SECRET_ACCESS_KEY_Form.get())
  self.role = str(self.AWS_ROLE_ARN_Form.get())
  self.region = str(self.AWS_REGION_Form.get())
  self.instanceID = str(self.AWS_INSTANCE_ID_Form.get())
  </code></pre>
  
  <p>Is there a way to use different credentials in <code>boto3</code> without restarting the program?</p>