Why error handling doesn’t work in repl but in VSCode it does? discord.py

I am trying to handle errors for local commands of my discord bot and I get the following error discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: ‘Command’ object has no attribute ‘MissingRequiredArgument’ this only happens when I execute the code in repl and not in VSCode.I also tried the following

commands.errors.MissingRequiredArgument
@youtube.error
async def youtube_error(ctx,error):
    if isinstance(error, commands.MissingRequiredArgument):
        await ctx.send("Some text")
@tts.error
async def tts_error(ctx,error):
    if isinstance(error, commands.MissingRequiredArgument):
        await ctx.send("Some text")

Answer

You should send the complete code, but if I understood well, the problem is that in your file exists a Command object called commands, so that MissingRequiredArgument is interpreted by repl as a Command object attribute, that obviously doesn’t exist.
There should be something like this in your code:

@Bot.command()
async def commands(ctx, *args):
    ...

Repl vs VS Code

Repl is for beginners/dummies, Visual Studio Code isn’t.
The VS Code’s interpreter probably understood `commands` wasn’t referred to your command, so it doesn’t raise any error.