I'm trying to code a discord bot, so, to avoid showing the token directly in the code, I'm going for an environmental variable.
In my TOKEN.env file, I wrote TOKEN=*token*, and this is my code, but Python won't get the variable.
import os
import discord
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv('TOKEN')
bot = commands.Bot(command_prefix='$')
bot.run(TOKEN)
I'm using pycharm and Python 3.9