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!
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.
Ok - thanks for your answer.