# Loading multiple models with a for loop?

**URL:** https://discourse.processing.org/t/loading-multiple-models-with-a-for-loop/28395
**Category:** Beginners
**Created:** [March 10, 2021, 3:33pm UTC](https://discourse.processing.org/t/loading-multiple-models-with-a-for-loop/28395 "2021-03-10T15:33:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![lucienfradet](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@lucienfradet](https://discourse.processing.org/u/lucienfradet)
#### Post date: [March 10, 2021, 3:33pm UTC](https://discourse.processing.org/t/loading-multiple-models-with-a-for-loop/28395/1 "2021-03-10T15:33:49Z")

</div>

Hello!

I’m trying to load 15 different 3D models in P5 and make them appear at specific time.  
Is there a way to load models with a “for loop” and place the models in an array? I’m a complete beginner 😕

Here’s what I’m trying to do:

```auto
let woman_frames = [];

function preload() {
for (let i = 1; i < 15; i++) {
  woman_frames[i] = 
    
  loadModel('woman_frames/'woman_framei[i].obj')
}
}

```

Thanks

> please format code with \</\> button \* [homework policy](https://discourse.processing.org/faq/#homework) \* [asking questions](https://discourse.processing.org/t/2147)

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [March 10, 2021, 4:00pm UTC](https://discourse.processing.org/t/loading-multiple-models-with-a-for-loop/28395/2 "2021-03-10T16:00:58Z")

</div>

> [@lucienfradet](#):
>
> ` loadModel('woman_frames/'woman_framei[i].obj')`

```auto
  loadModel('woman_frames'+i+'.obj')

```

this should work when your file names are

woman\_frames0.obj  
woman\_frames1.obj

etc.

by the way, arrays usually start with 0 not with 1

Hey, and welcome to the forum!

Great to have you here!

Warm regards,

Chrisir

---

<div class="post-metadata">

### Author: ![lucienfradet](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@lucienfradet](https://discourse.processing.org/u/lucienfradet)
#### Post date: [March 13, 2021, 2:20pm UTC](https://discourse.processing.org/t/loading-multiple-models-with-a-for-loop/28395/3 "2021-03-13T14:20:03Z")

</div>

Thank you so much! 🙂  
It worked perfectly!

warm regards to you too!
