# \[SOLVED\] How can I make an include file for my scripts - SOLVED THANKS

**URL:** https://discourse.processing.org/t/solved-how-can-i-make-an-include-file-for-my-scripts-solved-thanks/1569
**Category:** Libraries
**Created:** [July 7, 2018, 4:57am UTC](https://discourse.processing.org/t/solved-how-can-i-make-an-include-file-for-my-scripts-solved-thanks/1569 "2018-07-07T04:57:11Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![malcolm\_gc](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/malcolm_gc/32/694_2.png) [@malcolm\_gc](https://discourse.processing.org/u/malcolm_gc)
#### Post date: [July 7, 2018, 4:57am UTC](https://discourse.processing.org/t/solved-how-can-i-make-an-include-file-for-my-scripts-solved-thanks/1569/1 "2018-07-07T04:57:11Z")

</div>

I am having a lovely time playing with a script that draws a sonar for an Arduino output.

My script runs, I can read my Arduino outputs over the serial port, my sonar gets drawn.

I created some variables that I decide could be put into an include file that I could drag into other scripts but I cannot find anywhere that provides me with an example of how to do it so maybe you cant have include files and have to use import files, so I looked for a nice easy example of how to do that, couldn’t find anything,

So, can some one point me to where I can see an example of how to make an include or import file that contains variables that can be used in multiple scripts.

Additionally, is there a repository of samples/uploads of scripts that others have written

as to the include/import/library I am looking for something like

create a file something like  
variables.h

```auto
color light_green = color(204, 255, 209);
color black = color(0, 0, 0);
color white = color(255, 255, 255);
 
color red = color(255, 0, 0);
color green = color(0, 255, 0);
color blue = color(0, 0, 255);

```

place in the script file  
include variables.h

---

<div class="post-metadata">

### Author: ![Honny](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/honny/32/672_2.png) [@Honny](https://discourse.processing.org/u/Honny)
#### Post date: [July 7, 2018, 6:46am UTC](https://discourse.processing.org/t/solved-how-can-i-make-an-include-file-for-my-scripts-solved-thanks/1569/2 "2018-07-07T06:46:32Z")

</div>

you have just to create a “variables.pde” file and put in your main skecth folder.

all the others pde source files automatically will see the contents of “variables.pde” without the need to use a clause as #include.

---

<div class="post-metadata">

### Author: ![Honny](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/honny/32/672_2.png) [@Honny](https://discourse.processing.org/u/Honny)
#### Post date: [July 7, 2018, 6:56am UTC](https://discourse.processing.org/t/solved-how-can-i-make-an-include-file-for-my-scripts-solved-thanks/1569/3 "2018-07-07T06:56:47Z")

</div>

My personal experience when transitioning from C like languges to Processing has been to create 3 files to better organize my projects :

- headers.pde ( where i put all the imports of the libraries that i need )
- const.pde ( where i put all const values )
- globals.pde ( where i put global variables )

anyway this is just my personal way to do it.

---

<div class="post-metadata">

### Author: ![malcolm\_gc](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/malcolm_gc/32/694_2.png) [@malcolm\_gc](https://discourse.processing.org/u/malcolm_gc)
#### Post date: [July 7, 2018, 7:05am UTC](https://discourse.processing.org/t/solved-how-can-i-make-an-include-file-for-my-scripts-solved-thanks/1569/4 "2018-07-07T07:05:35Z")

</div>

variables.pde Awsome, works a treat.

I took that information and went looking for it on the web and was pointed to [http://processingjs.org/learning](http://processingjs.org/learning) which had an example of using a pde file.

Thank you very much!!!
