Passing variables between functions client-side

What I’m trying to do:

Make it so that my button_click function can access a variable set during init (or in any other function client side), without resorting to data tables which slow down the app, whose USP will be near-instant loading times.

For example, I want to set a variable ‘letter’ as ‘A’ upon init, and have the button click function know that ‘letter’ = ‘A’.

Ghastly hack used so far:

Setting hidden label component text with the variables I want to be able to access.

Question:

Is there a proper way of doing this client side that I’ve missed, without involving lots of code or data tables e.g. something similar to using ‘self’ as it applies to accessing components?

You could set an attribute on the form instance during its init:

class MyForm(MyFormTemplate):

    def __init__(self, **properties):
        self.letter = "A"
        self.init_components(**properties)

    def button_click(self, **event_args):
        print(self.letter)
1 Like

This works beautifully, thanks!