Can't import load_dotenv?

I’m getting an error when trying to import load_dotenv while coding a Discord bot in Python. Here is my current code:

from discord.ext import commands
import os
from dotenv import load_dotenv

token = os.getenv('DISCORD_TOKEN')

client = commands.Bot(command_prefix = '.')

Error message:

Traceback (most recent call last):
  File "/home/pi/Rotomi/", line 5, in <module>
    from dotenv import load_dotenv
ImportError: cannot import name 'load_dotenv' from 'dotenv' (/home/pi/.local/lib/python3.7/site-packages/dotenv/

The error message suggests that the load_dotenv function could not be imported from the dotenv library. This could be due to an outdated version of the dotenv library. Try updating the dotenv library by running pip install --upgrade python-dotenv in your terminal or command prompt. If that doesn’t work, try uninstalling and reinstalling the dotenv library with pip uninstall dotenv followed by pip install python-dotenv.