Passing an additional argument to a function


Can I pass an additional argument that is not an input in a

something like:

Thank you for your great support and for the developers for making Gradio!

1 Like

Hi @LittleWing ! Unfortunately, click does not support arbitrary **kwargs. What are you trying to accomplish? There might be another way!

Hi @freddyaboulton Thanks for the quick reply!

I’ll try to explain,

I’m trying to write a code that connects to various switches (Networking) in my organization
I’m sending an api requests via the requests library.

I have 2 buttons:

  1. ‘show selected switches version’
  2. upgrade selected switches

lets say a user pressed button number 1 for switch x, the code will send a login api request which grabs the cookie for switch x
if he will then press button number 2 to upgrade switch x the code will send another login api request
resulting with a new cookie, which I don’t want

Because the binds one function per button I couldn’t find a way to bypass that there wont be a new request for every button.


Hi @LittleWing ! Sorry it took me a while to get back to you.

Can you use a gr.Variable/gr.State (State In Blocks) to keep track of whether the first button is clicked before the second one?


Thank you for the reply and support!

Its certainly a valid option to try! :slight_smile: - I’ll give it a shot! , I will update if new issues arise

Thank you so much @freddyaboulton :slight_smile: