Environment variables
On the right side of the Code Editor, you can toggle between:
- UI Preview: A real-time preview of your form.
- Environment Variables: A panel where you define key-value pairs for use in your Python code.
Adding Environment Variables
- Click + Add Variable.
- Provide a Name for your variable (e.g., API_KEY).
- Enter a Value (e.g., abcd1234).
- (Optional) Check Secure to mask the value and prevent it from appearing in exported templates.
- To remove a variable, click Delete on the right side of its entry.
Accessing Environment Variables
In your Python code, simply import them from environments:
from environments import (
variable_name_1,
variable_name_2,
variable_name_3
)
def on_button_click(path):
# Now you can reference variable_name_1, etc.
pass
Tip: Use Secure variables for sensitive information like API keys or tokens to prevent accidental exposure in shared code or exported configurations.
Updated 17 days ago