# Need help with my code

**URL:** <https://forum.codewithmosh.com/t/need-help-with-my-code/24709>\
**Category:** Python\
**Created:** [January 22, 2024, 7:45pm UTC](https://forum.codewithmosh.com/t/need-help-with-my-code/24709 "2024-01-22T19:45:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikola\_Kocev](https://avatars.discourse-cdn.com/v4/letter/n/46a35a/32.png) [@Nikola\_Kocev](https://forum.codewithmosh.com/u/Nikola_Kocev)\
**Post date:** [January 22, 2024, 7:45pm UTC](https://forum.codewithmosh.com/t/need-help-with-my-code/24709/1 "2024-01-22T19:45:57Z")

</div>

![koda](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/8/8272c18d9526399cb3419b17453b85ccdf002693.png)

Hello. I started new project in python and i wanted to make a ATM in python so i asked my profesor for help because i didnt know how to save data in another file but now i ran in another problem and i am asking you for help. As you can see in the photo i have created new file saved.py and there is saved “money” for the “ATM”. But when i try to withdrawal it just deletes the data that is writen in saved.py and it says that it is not readable.

---

<div class="post-metadata">

**Author:** ![Harvel](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/harvel/32/7651_2.png) [@Harvel](https://forum.codewithmosh.com/u/Harvel)\
**Post date:** [January 23, 2024, 7:07am UTC](https://forum.codewithmosh.com/t/need-help-with-my-code/24709/2 "2024-01-23T07:07:18Z")

</div>

You are redefining variable “f” by opening it in the write mode, then your mistake is that you are trying to read a value of a writable file, that’s definitely an invalid operation

---

<div class="post-metadata">

**Author:** ![Harvel](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/harvel/32/7651_2.png) [@Harvel](https://forum.codewithmosh.com/u/Harvel)\
**Post date:** [January 23, 2024, 7:09am UTC](https://forum.codewithmosh.com/t/need-help-with-my-code/24709/3 "2024-01-23T07:09:06Z")

</div>

In your second if block of withdrawal, use a different identifier for the readable file #variable name

---

<div class="post-metadata">

**Author:** ![Harvel](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/harvel/32/7651_2.png) [@Harvel](https://forum.codewithmosh.com/u/Harvel)\
**Post date:** [January 23, 2024, 7:09am UTC](https://forum.codewithmosh.com/t/need-help-with-my-code/24709/4 "2024-01-23T07:09:56Z")

</div>

That way you will be dealing with different entities😊
