# Load image using code on pavlovia

**URL:** <https://discourse.psychopy.org/t/load-image-using-code-on-pavlovia/20231>\
**Category:** Online experiments\
**Tags:** pavlovia\
**Created:** [February 5, 2021, 11:49am UTC](https://discourse.psychopy.org/t/load-image-using-code-on-pavlovia/20231 "2021-02-05T11:49:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henning\_Holle](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/henning_holle/32/7689_2.png) [@Henning\_Holle](https://discourse.psychopy.org/u/Henning_Holle)\
**Post date:** [February 5, 2021, 11:49am UTC](https://discourse.psychopy.org/t/load-image-using-code-on-pavlovia/20231/1 "2021-02-05T11:49:38Z")

</div>

Hi,

I have a task that is more or less set up now. There is an innner trial loop and an outer blocks loop, and thisi all works fine. What I want to add now is to load in an image dynimcally at the block (in the routine break\_ch (see screenshot below of my setup).

I have added the following code for this  
ch\_pic = “stim/ch” + str(block\_n) + “.jpg”

This works fine locally, showing me a different picture after each block, but online I get an unknown ressource error. Any suggestions would be welcome  
Henning

 ![Screenshot 2021-02-05 at 11.37.00](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/c/d/cd3ff2e5a57b762e9b2e463ce4dca0664e80f094.png)  
 ![Screenshot 2021-02-05 at 11.46.18](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/5/c/5cb53b47b5e8bd0267d3131b89cf42f7f440df90.png)

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [February 5, 2021, 3:00pm UTC](https://discourse.psychopy.org/t/load-image-using-code-on-pavlovia/20231/2 "2021-02-05T15:00:55Z")

</div>

Hello Henning,

are the pictures you want to show sync on Pavolvia and did you add them via the **Experiment Settings** - **Online** - **Additional resources**?

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![Henning\_Holle](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/henning_holle/32/7689_2.png) [@Henning\_Holle](https://discourse.psychopy.org/u/Henning_Holle)\
**Post date:** [February 5, 2021, 4:43pm UTC](https://discourse.psychopy.org/t/load-image-using-code-on-pavlovia/20231/3 "2021-02-05T16:43:11Z")

</div>

Hi Jens,  
there were showing up on pavlovia, but before I did not explicitly include them as additional resources. Adding them there did the trick, thanks a lot for the tip!  
Best wishes  
Henning
