# How to instantiate an already created object that exists in another file?

**URL:** https://discourse.processing.org/t/how-to-instantiate-an-already-created-object-that-exists-in-another-file/6083
**Category:** Processing
**Created:** [November 29, 2018, 9:21pm UTC](https://discourse.processing.org/t/how-to-instantiate-an-already-created-object-that-exists-in-another-file/6083 "2018-11-29T21:21:00Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![klaik30](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@klaik30](https://discourse.processing.org/u/klaik30)
#### Post date: [November 29, 2018, 9:21pm UTC](https://discourse.processing.org/t/how-to-instantiate-an-already-created-object-that-exists-in-another-file/6083/1 "2018-11-29T21:21:00Z")

</div>

Hi, I’m trying to avoid having all my created objects in the same file I want to use these objects in. I have a file called “FlowFields” and in another file, I have a “Particle” object that I want to use in my FlowFields file. I tried just instantiating the object normally like:

```auto
Particle particle = new Particle();

```

This only works if I have the code for the object inside of the main file FlowFields. For the record, both of these files exist in the same folder on my computer.

Help appreciated!

Thanks.

---

<div class="post-metadata">

### Author: ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)
#### Post date: [November 29, 2018, 9:34pm UTC](https://discourse.processing.org/t/how-to-instantiate-an-already-created-object-that-exists-in-another-file/6083/2 "2018-11-29T21:34:42Z")

</div>

Just hit this button, create a new file (tab) and start to write your class code inside :

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/3/31e5edd31987a62663ae23fcce70efa5e1746351.png)

---

<div class="post-metadata">

### Author: ![klaik30](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@klaik30](https://discourse.processing.org/u/klaik30)
#### Post date: [November 29, 2018, 9:39pm UTC](https://discourse.processing.org/t/how-to-instantiate-an-already-created-object-that-exists-in-another-file/6083/3 "2018-11-29T21:39:35Z")

</div>

Well that’s a bit embarrassing. I swear I did that in my last project and it didn’t work…

Either way, thank you! It worked this time as intended.

---

<div class="post-metadata">

### Author: ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)
#### Post date: [November 29, 2018, 9:40pm UTC](https://discourse.processing.org/t/how-to-instantiate-an-already-created-object-that-exists-in-another-file/6083/4 "2018-11-29T21:40:32Z")

</div>

I don’t know either.  
Have a great day 😃
