Create HUBL var from custom module value



I would like to make one of the values from my custom module into a hubl variable ( this is all still inside the custom module, so it shouldn’t need to be exported to the template?). The purpose of this is so that I can call information from a hubDB based on the selection of a choice field. However this doesn’t work:

{% set comm_id = widget.communities %}

widget.communities being the variable from the choice field in the custom module.
Any input on this would be appreciated.