Boto3 uses old credentials

I am using

tkinter

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

boto3

would carry on using the old credentials.

I'm not sure why it keeps using the old credentials because I am running everything again using the currently entered credentials.

This is a snippet of the code that sets the environment variables and launches

boto3

. It works perfectly fine if you enter the right credentials the first time.