如何从 @client.command 函数中获取一个值并将其实现到另一个中

How can I get one value from a @client.command function and implement it into another

我将一个字典初始化为一个数据框,该数据框在 discord.py 的 @client.command 函数中具有值。我想在我编写的下一个函数中使用这个数据框。我不确定该怎么做。

假设你有这样的命令

@client.command()
async def test(ctx, arg)
    await ctx.send("the variable is " +  arg)

您可以使用全局变量共享它


argument = ""

@client.command()
async def test(ctx, arg)
    global argument
    argument = arg
    await ctx.send("the variable is " +  arg)

@client.command()
async def anothertest(ctx)
    global argument
    await ctx.send("the previous arg is " +  argument)