# Variable in a custom module text field

**URL:** <https://community.hubspot.com/t/variable-in-a-custom-module-text-field/120378>\
**Category:** CMS Development\
**Created:** [November 13, 2024, 6:08am UTC](https://community.hubspot.com/t/variable-in-a-custom-module-text-field/120378 "2024-11-13T06:08:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![KShapovalov](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@KShapovalov](https://community.hubspot.com/u/KShapovalov)\
**Post date:** [November 13, 2024, 6:08am UTC](https://community.hubspot.com/t/variable-in-a-custom-module-text-field/120378/1 "2024-11-13T06:08:50Z")

</div>

Hello, can I use variables defined in a custom module inside a text field of that module in the content manager?

 ![KShapovalov_0-1731477989722.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/1/5/15dede6b329cb6949cbb0c711aff4e93d63c4ee9.png)

---

<div class="post-metadata">

**Author:** ![Anton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/anton/32/103167_2.png) [@Anton](https://community.hubspot.com/u/Anton)\
**Post date:** [November 13, 2024, 3:00pm UTC](https://community.hubspot.com/t/variable-in-a-custom-module-text-field/120378/2 "2024-11-13T15:00:07Z")

</div>

Hi @KShapovalov,

yes it’s possible.

In order to use variables, you have to define them somewhere. It can be the module itself or an external file(recommended if you want to reuse variables in different places).

Here’s an example:

```lia-code-sample
{% set my_variable = "Hello World" %} {# Module specific variable #}
{% import 'PATH-TO-VARIABLES-FILE.html' %} {# Importing a file from outside the module #}

{{ module.text_field }}

```

Result:

 ![Bildschirmfoto 2024-11-13 um 15.57.36.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/e/3/e333468205dee33706db0c7ad46728bddfec93b0.png)

best,

Anton

---

<div class="post-metadata">

**Author:** ![GRajput](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/grajput/32/102020_2.png) [@GRajput](https://community.hubspot.com/u/GRajput)\
**Post date:** [November 14, 2024, 6:45am UTC](https://community.hubspot.com/t/variable-in-a-custom-module-text-field/120378/3 "2024-11-14T06:45:07Z")

</div>

Hi @KShapovalov

Yes, You can use the variable in the text field if you have defined this variable in your module like this

**{% set var1 = ‘123’ %}**

I hope this will help you out. Please mark it as **Solution Accepted and upvote** to help another Community member.  
Thanks!
