# Adding code from one screen to another

**URL:** https://community.thunkable.com/t/adding-code-from-one-screen-to-another/2799180
**Category:** Questions about Thunkable X
**Created:** [January 23, 2024, 7:29pm UTC](https://community.thunkable.com/t/adding-code-from-one-screen-to-another/2799180 "2024-01-23T19:29:00Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![bschwartzsxc2](https://avatars.discourse-cdn.com/v4/letter/b/7c8e57/32.png) [@bschwartzsxc2](https://community.thunkable.com/u/bschwartzsxc2)
#### Post date: [January 23, 2024, 7:29pm UTC](https://community.thunkable.com/t/adding-code-from-one-screen-to-another/2799180/1 "2024-01-23T19:29:00Z")

</div>

I have a student who wants to get some code from Screen 5 (Button 30) and include it on Screen 2. Ultimately, what she wants is on Screen 2 she wants to be able to click “Math Problem” which then takes her to Screen 5. Then, she wants the Task 1 button to change to “Math Problem”. Here’s her project [https://x.thunkable.com/copy/4b5d6da1de546918fce96ca56166d68c](https://x.thunkable.com/copy/4b5d6da1de546918fce96ca56166d68c)

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [January 23, 2024, 7:42pm UTC](https://community.thunkable.com/t/adding-code-from-one-screen-to-another/2799180/2 "2024-01-23T19:42:56Z")

</div>

You can click on a block or set of blocks (e.g. an event block) and copy it (Edit–\>Copy) as you would text. Then go to the other screen, click anywhere (not sure if that’s necessary) and paste it (Edit–\>Paste).

**One caution:** avoid copying and pasting variable initialization blocks. It can ruin a project to have duplicate initialize blocks! If you plan to copy & paste code, consider having a single screen in the project for ALL initialize blocks.

---

<div class="post-metadata">

### Author: ![steve\_synopsis](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@steve\_synopsis](https://community.thunkable.com/u/steve_synopsis)
#### Post date: [January 23, 2024, 7:48pm UTC](https://community.thunkable.com/t/adding-code-from-one-screen-to-another/2799180/3 "2024-01-23T19:48:06Z")

</div>

If I understand,

On Screen 2, Clicking Math Problem → Screen 5 and change Task 1 button to read “Math Problem”.

So, on Screen 2 -

![2024-01-23 15 45 03](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/1/217b2945a1ec044c97b4ae4260f4d010d8661ce2.png)

and on screen 5

![2024-01-23 15 45 20](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/3/c36d4a66b1924618083860ba650dfb1e7b71cb06.png)

For readability and ease of troubleshooting, you should encourage your students to take the time to name the buttons.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)
#### Post date: [April 22, 2024, 7:48pm UTC](https://community.thunkable.com/t/adding-code-from-one-screen-to-another/2799180/4 "2024-04-22T19:48:26Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
