# Environment Variables and how to use them

**URL:** <https://forum.freecodecamp.org/t/environment-variables-and-how-to-use-them/483090>\
**Category:** Curriculum Help\
**Tags:** python\
**Created:** [October 25, 2021, 1:57pm UTC](https://forum.freecodecamp.org/t/environment-variables-and-how-to-use-them/483090 "2021-10-25T13:57:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ethandupro](https://avatars.discourse-cdn.com/v4/letter/e/5fc32e/32.png) [@Ethandupro](https://forum.freecodecamp.org/u/Ethandupro)\
**Post date:** [October 25, 2021, 1:57pm UTC](https://forum.freecodecamp.org/t/environment-variables-and-how-to-use-them/483090/1 "2021-10-25T13:57:28Z")

</div>

When I was watching one of the videos about Python, (How to make a Discord bot, link: [https://www.youtube.com/watch?v=SPTfmiYiuok](https://www.youtube.com/watch?v=SPTfmiYiuok)) I found out that when using the new environment variables, the script did not work. I’ll put a screenshot with this topic

 ![Screenshot (434)_LI](https://global.discourse-cdn.com/freecodecamp/original/3X/c/6/c61df57cc7b0eaf6eae7313441c9bd677feb2140.jpeg)

---

<div class="post-metadata">

**Author:** ![jwilkins.oboe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jwilkins.oboe/32/179497_2.png) [@jwilkins.oboe](https://forum.freecodecamp.org/u/jwilkins.oboe)\
**Post date:** [October 25, 2021, 2:49pm UTC](https://forum.freecodecamp.org/t/environment-variables-and-how-to-use-them/483090/2 "2021-10-25T14:49:20Z")

</div>

Hi @Ethandupro !

Welcome to the forum!

Please read through my explanation on how to use env variables in replit.  
It will help you see the error in your code.

> [@Steps on how to setup environment variable for FCC Python Bot Tutorial](https://forum.freecodecamp.org/t/steps-on-how-to-setup-environment-variable-for-fcc-python-bot-tutorial/473303):
>
> Read this post if you are watching the [Code a Discord Bot](https://www.youtube.com/watch?v=SPTfmiYiuok) tutorial by FCC and don’t know how to setup your environment variables in replit. A few months ago, Replit changed how to add environment variables. The suggestions from the video will not work. Here is what you do. Use this starter code from [discord.py docs](https://discordpy.readthedocs.io/en/stable/quickstart.html) This is the exact same code from the video. You can just copy it. import discord client = discord.Client() @client.event async def on\_ready(): print('We have logged in as {…

---

<div class="post-metadata">

**Author:** ![Ethandupro](https://avatars.discourse-cdn.com/v4/letter/e/5fc32e/32.png) [@Ethandupro](https://forum.freecodecamp.org/u/Ethandupro)\
**Post date:** [October 26, 2021, 12:27pm UTC](https://forum.freecodecamp.org/t/environment-variables-and-how-to-use-them/483090/3 "2021-10-26T12:27:29Z")

</div>

Thanks for your advice I tried it and it works

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [April 27, 2022, 12:27am UTC](https://forum.freecodecamp.org/t/environment-variables-and-how-to-use-them/483090/4 "2022-04-27T00:27:47Z")

</div>

Closed on April 27, 2022, 12:27am UTC

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
