# Saved over code from compiling builder - Restore?

**URL:** <https://discourse.psychopy.org/t/saved-over-code-from-compiling-builder-restore/6733>\
**Category:** Coding\
**Created:** [February 18, 2019, 8:27pm UTC](https://discourse.psychopy.org/t/saved-over-code-from-compiling-builder-restore/6733 "2019-02-18T20:27:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiaoliuub](https://avatars.discourse-cdn.com/v4/letter/x/9de053/32.png) [@xiaoliuub](https://discourse.psychopy.org/u/xiaoliuub)\
**Post date:** [February 18, 2019, 8:27pm UTC](https://discourse.psychopy.org/t/saved-over-code-from-compiling-builder-restore/6733/1 "2019-02-18T20:27:01Z")

</div>

So I’m new to PsychoPy and I didn’t realize that compiling the Builder view would replace my previous code. I had done a lot of work in coder so I’m not sure if there is a way to restore to a previously saved version? Any help would be appreciated thanks!

---

<div class="post-metadata">

**Author:** ![Michael](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/michael/32/16_2.png) [@Michael](https://discourse.psychopy.org/u/Michael)\
**Post date:** [February 19, 2019, 2:01am UTC](https://discourse.psychopy.org/t/saved-over-code-from-compiling-builder-restore/6733/2 "2019-02-19T02:01:42Z")

</div>

No. Builder must regenerate that script every time that you make a change. If you want to permanently edit that script manually, you have to save it to a separate file, and then the link between it and the graphical Builder representation is severed (i.e. Builder can’t possibly know how to integrate its automatically-generated code with yours, so once you edit the code, you can’t then go back to also making changes to it with the Builder GUI).

The solution to this is almost always to not edit the generated script manually, but instead to use Code Components within the Builder interface. These allow you to write custom code, but Builder itself knows about it and so can take care of inserting it in exactly the right place (e.g. to run at the start of the experiment, at the beginning of a routine, on each frame, and so on.)

That way, you can keep regenerating the Python script while also modifying it with your custom code, having the best of both worlds.

---

<div class="post-metadata">

**Author:** ![xiaoliuub](https://avatars.discourse-cdn.com/v4/letter/x/9de053/32.png) [@xiaoliuub](https://discourse.psychopy.org/u/xiaoliuub)\
**Post date:** [February 19, 2019, 9:33am UTC](https://discourse.psychopy.org/t/saved-over-code-from-compiling-builder-restore/6733/3 "2019-02-19T09:33:29Z")

</div>

Ok - thanks for your answer.
