https://discord.gg/botpress logo
#🌎general
Title
# 🌎general
w

worried-plumber-65401

06/09/2023, 4:40 PM
how can I declare a global variable inside action code of botpress cloud and use it other places in nodes as well as other actions in different workflow also in same chatbot?
a

acceptable-kangaroo-64719

06/09/2023, 4:42 PM
Hey @worried-plumber-65401, you can't declare global vars from within a code card, but you can change them there. To declare a global var, go to Chatbot Settings > Variables and put your global vars there.
Bot variables are the closest thing to traditional global vars, in that they're the same all throughout the bot and can be used or changed anywhere. Config variables are more like env vars, they're best kept for secrets like API keys
w

worried-plumber-65401

06/09/2023, 4:45 PM
I have already declared this as user Variables but not able to use it in actions when I write user.variable_name , it gives me error.
a

acceptable-kangaroo-64719

06/09/2023, 4:46 PM
what error? Could you share a screenshot?
w

worried-plumber-65401

06/09/2023, 4:46 PM
Yeah sure...
a

acceptable-kangaroo-64719

06/09/2023, 4:49 PM
aaah, sometimes the linter doesn't update variable names and you can ignore those errors. When you talk to the bot, does it act as expected?
w

worried-plumber-65401

06/09/2023, 4:50 PM
ah! I didn't checked it. Let me see.
Yeah It works fine, thanks Gordy
a

acceptable-kangaroo-64719

06/09/2023, 4:56 PM
Glad to hear it! There's still some work being done on the Typing and variable checking backend processes. It's a bit too technical for me to understand, but they don't typically affect performance.
2 Views