# How to replace value generated in robot framework into python data file?

**URL:** <https://forum.robotframework.org/t/how-to-replace-value-generated-in-robot-framework-into-python-data-file/6560>\
**Category:** Robot Framework\
**Created:** [14 December 2023 10:43 UTC](https://forum.robotframework.org/t/how-to-replace-value-generated-in-robot-framework-into-python-data-file/6560 "2023-12-14T10:43:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nishans](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@nishans](https://forum.robotframework.org/u/nishans)\
**Post date:** [14 December 2023 10:43 UTC](https://forum.robotframework.org/t/how-to-replace-value-generated-in-robot-framework-into-python-data-file/6560/1 "2023-12-14T10:43:51Z")

</div>

How can I replace the new value from “next\_mobile\_number” with the old value of “LOGIN\_MOBILE\_NUMBER” in python file?

# ======== Testcase

\*\*\* Test Cases \*\*\*  
Update Mobile Number In File  
${last\_mobile\_number} = Get Variable Value ${ONBOARDING\_MOBILE\_NUMBER}  
${next\_mobile\_number} = Evaluate ${last\_mobile\_number} + 1  
Set Global Variable ${ONBOARDING\_MOBILE\_NUMBER} ${next\_mobile\_number}

# ============= Testdata.py file

ONBOARDING\_MOBILE\_NUMBER = “79001011098888”

---

<div class="post-metadata">

**Author:** ![rasjani](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@rasjani](https://forum.robotframework.org/u/rasjani)\
**Post date:** [15 December 2023 08:06 UTC](https://forum.robotframework.org/t/how-to-replace-value-generated-in-robot-framework-into-python-data-file/6560/2 "2023-12-15T08:06:11Z")

</div>

Updating an actual Python file at runtime is _Very Bad Idea_.

Store the actual number in separate file and update that when needed.
