Error: Cannot import ui from discord

I’m trying to import ui from discord to create buttons, views, etc. However, whenever I try to import it, it returns an error. I’ve tried all the ways I can import it:

from discord import ui
from discord.ui import *
from discord.ui.view import *

Yet none of these work! What’s wrong?

none of these work! What’s wrong?

whenever I try to import it, it returns an error.

People come into programming without being aware of this, and I’m happy to tell them. An error occurring actually tells you more than the condition that the program isn’t working. Errors can come with a message that describes what’s wrong. And that’s what you’re asking here, which is great!

I’d like to have you take a fresh look at the error and see if you can identify a message in it that tries to tell you what’s wrong. And it might be written in a way that you don’t understand, or it might not really point you toward any concrete way to fix what’s wrong, but I think doing this on its own–looking at an error as something that’s trying to help you–will be valuable.

5 Likes

Oh I figured it out. I’m using discord 1.7.3. How do I update to the latest version? (Or find a workaround for buttons if I can’t)

it looks like the new version requires Python 3.8 or above. we don’t have that yet on glitch.

1 Like