# The file"..." needs to be inside a sketch folder named "..."

**URL:** <https://discourse.processing.org/t/the-file-needs-to-be-inside-a-sketch-folder-named/25903>\
**Category:** Processing.py\
**Created:** [December 2, 2020, 7:00pm UTC](https://discourse.processing.org/t/the-file-needs-to-be-inside-a-sketch-folder-named/25903 "2020-12-02T19:00:39Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![lafitte\_que](https://avatars.discourse-cdn.com/v4/letter/l/b9bd4f/32.png) [@lafitte\_que](https://discourse.processing.org/u/lafitte_que)\
**Post date:** [December 2, 2020, 7:00pm UTC](https://discourse.processing.org/t/the-file-needs-to-be-inside-a-sketch-folder-named/25903/1 "2020-12-02T19:00:39Z")

</div>

Hello,

When using processing.py, I often have to open projects with multiple files inside a single folder. Every time I try opening the main file Processing wants to create a new folder even if the folder I am working with has already the same name than my script.

This leads to a project with a path like this: “… \ Crowd\_Model \ Crowd\_Model \ Crowd\_Model …”. It is annoying and I don’t know why it occurs. Is it because of the other scripts or because of the name of the file? I did not find a topic about this problem so I hope someone will know why I have this issue.

My folder: “Crowd\_Model”

Files inside the folder:

- “Agent$py.class”
- “Agent.py”
- “Crowd\_Model.py”
- “Point$py.class”
- “Point.py”
- “QuadTree$py.class”
- “QuadTree.py”
- “Rectangle$py.class”
- “Rectangle.py”

My Projects in Java work with no issues. When the issue occurs, it is possible that the message disappear (but still runs on the computer) and makes it impossible to open processing again without closing this error message (I used the task manager to fix this).

---

<div class="post-metadata">

**Author:** ![tabreturn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tabreturn/32/3697_2.png) [@tabreturn](https://discourse.processing.org/u/tabreturn)\
**Post date:** [December 2, 2020, 7:39pm UTC](https://discourse.processing.org/t/the-file-needs-to-be-inside-a-sketch-folder-named/25903/2 "2020-12-02T19:39:54Z")

</div>

Welcome @lafitte_que

I tested this on my computer, but couldn’t replicate the problem. Perhaps I’ve done something differently? What version of Processing and OS are you running?

 ![Screenshot from 2020-12-03 08-35-05](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/1/13ed64be7e69d00604c30b294be411e5004bcf73.png)

Note that the main sketch file (_Crowd\_Model.pyde_) has a _.pyde_ extension. _The Crowd\_Model_ class has a _.py_ extension. When I run Processing, I open the pyde file, and the rest automatically appear in the tabs.

---

<div class="post-metadata">

**Author:** ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)\
**Post date:** [December 2, 2020, 7:57pm UTC](https://discourse.processing.org/t/the-file-needs-to-be-inside-a-sketch-folder-named/25903/3 "2020-12-02T19:57:28Z")

</div>

Welcome @lafitte_que! That’s a good question, it seems to be a very annoying situation.

Could it be that your system is automatically renaming the Crowd\_Model.pyde file in some subtle way (like the extension or some hidden character)?

I couldn’t imagine another idea right now. I hope you find some solution.

---

<div class="post-metadata">

**Author:** ![lafitte\_que](https://avatars.discourse-cdn.com/v4/letter/l/b9bd4f/32.png) [@lafitte\_que](https://discourse.processing.org/u/lafitte_que)\
**Post date:** [December 2, 2020, 7:59pm UTC](https://discourse.processing.org/t/the-file-needs-to-be-inside-a-sketch-folder-named/25903/4 "2020-12-02T19:59:39Z")

</div>

I just changed my file extension from “.py” to “.pyde” and it works perfectly so I suppose it was the problem.

I don’t know if it’s still usefull but my OS is Windows 10 and I’m using processing 3.5.4.

Thank you very much for your help and for your time trying to replicate my project folder.

---

<div class="post-metadata">

**Author:** ![daphnakaplan](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/daphnakaplan/32/15071_2.png) [@daphnakaplan](https://discourse.processing.org/u/daphnakaplan)\
**Post date:** [November 22, 2021, 4:11pm UTC](https://discourse.processing.org/t/the-file-needs-to-be-inside-a-sketch-folder-named/25903/5 "2021-11-22T16:11:44Z")

</div>

I have the same problem with windows + processing 3.5.4 + .pde files  
It is impossible to put a couple of files under the same folder…

---

<div class="post-metadata">

**Author:** ![tabreturn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tabreturn/32/3697_2.png) [@tabreturn](https://discourse.processing.org/u/tabreturn)\
**Post date:** [November 22, 2021, 6:26pm UTC](https://discourse.processing.org/t/the-file-needs-to-be-inside-a-sketch-folder-named/25903/6 "2021-11-22T18:26:36Z")

</div>

Welcome @daphnakaplan – could you provide a screenshot of your project files? This likely has something to do with how you’ve named/structured your files.

---

<div class="post-metadata">

**Author:** ![daphnakaplan](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/daphnakaplan/32/15071_2.png) [@daphnakaplan](https://discourse.processing.org/u/daphnakaplan)\
**Post date:** [November 23, 2021, 9:43am UTC](https://discourse.processing.org/t/the-file-needs-to-be-inside-a-sketch-folder-named/25903/7 "2021-11-23T09:43:56Z")

</div>

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/be47cbcc8df444e0a30156baf18cf237c4d26e75.png)  
Here is an example:  
Let’s say I have a folder named test and a test.pde && test2.pde files inside  
I can open both files (in tabs) no problem  
However,  
If I have a test2.pde inside a ‘test’ folder - impossible to open without creating a new folder called ‘test2’

I guess this is intentional? but why? it makes files management very messy

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [November 23, 2021, 10:41am UTC](https://discourse.processing.org/t/the-file-needs-to-be-inside-a-sketch-folder-named/25903/8 "2021-11-23T10:41:37Z")

</div>

Hello @daphnakaplan,

This tutorial provides some insight:

> **[Environment](https://processing.org/environment/#overview)**
>
> The Processing Environment includes a text editor, a compiler, and a display window. It enables the creation of software within a carefully designed set of constraints.

`:)`

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [November 23, 2021, 4:47pm UTC](https://discourse.processing.org/t/the-file-needs-to-be-inside-a-sketch-folder-named/25903/9 "2021-11-23T16:47:21Z")

</div>

From: [Processing.org/environment/#sketches-and-sketchbook](https://Processing.org/environment/#sketches-and-sketchbook)

## Sketches and Sketchbook

All Processing projects are called sketches. Each sketch has its own folder. The main file for each sketch has the same name as the folder and is found inside. For example, if the sketch is named “Sketch\_123”, the folder for the sketch will be called “Sketch\_123” and the main file will be called “Sketch\_123.pde”. The PDE file extension is an acronym for the Processing Development Environment

Processing sketches can be stored anywhere on your computer, but by default they are stored in the sketchbook, which will be in different places on your computer or network depending if you use PC, Mac, or Linux and how the preferences are set. To locate this folder, select the “Preferences” option from the File menu (or from the “Processing” menu on the Mac) and look for the"Sketchbook location."

A sketch folder sometimes contains other folders for media files and other code. When a font or image is added to a sketch by selecting “Add File…” from the Sketch menu, a “data” folder is created. Files may also be added to your Processing sketch by dragging them into the text editor. Image and sound files dragged into the application window will automatically be added to the current sketch’s “data” folder. All images, fonts, sounds, and other data files loaded in the sketch must be in this folder.

---

<div class="post-metadata">

**Author:** ![tabreturn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tabreturn/32/3697_2.png) [@tabreturn](https://discourse.processing.org/u/tabreturn)\
**Post date:** [November 23, 2021, 6:03pm UTC](https://discourse.processing.org/t/the-file-needs-to-be-inside-a-sketch-folder-named/25903/10 "2021-11-23T18:03:11Z")

</div>

Python mode requires that each sketch resides in a folder with the same name as the sketch itself. So, _test.pyde_ is located in a folder named _test_; _test2.pyde_ is located in a folder named _test2_.

If you want to work on multiple sketches simultaneously, you launch separate instances of the Processing editor.

The editor tabs are for working on multi-file sketches. When you’re working on something complex, it’s useful to break up your Python code into multiple files. For example, you have a folder named _tetris_, which contains a _tetris.pyde_, _brick.py_, _timer.py_, etc. files. The _tetris.pyde_ is the file you run; you import the code from the other files into this. The .py files will appear in the tabs (so you can easily switch to and work on them).

There are ways to run Python Mode files outside of the Processing editor (from the command line) that will allow you to organise your files differently.

---

<div class="post-metadata">

**Author:** ![tabreturn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tabreturn/32/3697_2.png) [@tabreturn](https://discourse.processing.org/u/tabreturn)\
**Post date:** [November 23, 2021, 6:12pm UTC](https://discourse.processing.org/t/the-file-needs-to-be-inside-a-sketch-folder-named/25903/11 "2021-11-23T18:12:49Z")

</div>

As you’ve posted your question in the Processing.py section of the forum, I’ve used a Python example. If you’re using Java mode, the same (what I wrote above) is true, except all of the file extensions are _.pde_ not _.pyde/.py_
