Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

I have a dictionary initialized into a dataframe that has values inside a @client.command function for discord.py. I want to use this dataframe in the next function that I have written. I am unsure of how to do this.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

suppose you have a command like this

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

you can share it by using global variable


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)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading