# Previous value in variable

**URL:** <https://forum.robotframework.org/t/previous-value-in-variable/5420>\
**Category:** Robot Framework\
**Created:** [9 March 2023 15:57 UTC](https://forum.robotframework.org/t/previous-value-in-variable/5420 "2023-03-09T15:57:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thiagovasconceloos](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/thiagovasconceloos/32/2412_2.png) [@thiagovasconceloos](https://forum.robotframework.org/u/thiagovasconceloos)\
**Post date:** [9 March 2023 15:57 UTC](https://forum.robotframework.org/t/previous-value-in-variable/5420/1 "2023-03-09T15:57:30Z")

</div>

Guys, I have a script that consumes an api via python, and then I write the number generated in a robot variable to use in the test.  
however, it is recording in memory the value of the previous execution, even with the value of the variable updated in a robot.

example: call the request  
generated the number x  
and wrote x in the robot file  
but when I read the variable of x  
it shows the number y (previous)

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [9 March 2023 16:25 UTC](https://forum.robotframework.org/t/previous-value-in-variable/5420/2 "2023-03-09T16:25:54Z")

</div>

Make sure you read the variable again after being written to file.

Variables don’t work like in Python, they must be forcibly updated.
