How to run twitchio bot forever without manually adding the new token

I understand that if the bot access token expires we must get a new one from the refresh token and replace the token of my bot

bot = commands.Bot(
token=token,
client_id=os.environ[‘CLIENT_ID’],
nick = “mynick”,
prefix=“!”,
initial_channels=[channel]
)

bot.run()

However I don’t understand how I can replace the token automatically when without stopping my server and manually changing the token every time the token expires.

Any help would be extremely appreciated thanks.