Let's see the error again.
Its a simple Python code where I have imported the random module (a built-in module) and using the choice() method that returns a random element. But unfortunately, it threw the error.
Solution:
The solution is very simple and at the end I realize that I made a very common mistake.
Take another look at the image above 👆. The file is named random.py. It's crucial that the local file name differs from the module you're importing. This naming conflict "confused" the Python interpreter, leading it to believe "there's a circular dependency".
Note: A circular dependency occurs when two or more modules depend on each other directly or indirectly, creating a loop.
🚀 When working with Python, always ensure that your local file names (any file in the folder) do not match the names of Python's built-in modules that you are importing. This prevents conflicts and avoids confusing the Python interpreter.
Changing the name of the file solved the issue. Check this out.