# Accessing local elements in another function in p5js

**URL:** <https://discourse.processing.org/t/accessing-local-elements-in-another-function-in-p5js/36978>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [May 20, 2022, 5:20am UTC](https://discourse.processing.org/t/accessing-local-elements-in-another-function-in-p5js/36978 "2022-05-20T05:20:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lvndr](https://avatars.discourse-cdn.com/v4/letter/l/aeb1de/32.png) [@lvndr](https://discourse.processing.org/u/lvndr)\
**Post date:** [May 20, 2022, 5:20am UTC](https://discourse.processing.org/t/accessing-local-elements-in-another-function-in-p5js/36978/1 "2022-05-20T05:20:17Z")

</div>

I am pretty new to p5js and website building, I am doing a project for uni-related to emotion sensing Ai, basically, it generates recipes based on your emotion. I have built a random recipe generator but I need to append the ingredient (for eg. chamomile for neutral)to the original recipe.

1.-this is the webpage and the random recipe is generated by clicking on the generate recipe button.

2.-this is the code for generating the recipes I am using a CSV to access the data

3.-is there I can access them here above where (this is in the draw function) i can append the ingredients according to the emotion sensed for which the code is also in the draw function.

 ![Swimming Instructor](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/d/5/d539d8693aca6303ddb7d1d8e0f6d6c5a7fafb80.jpeg)  
(since i am a new user i cannot upload more than one images so complied all of them,the code screenshots are are numbered with the numbers of the explanation)
