# Files must be loaded inside setup() or after it has been called

**URL:** <https://discourse.processing.org/t/files-must-be-loaded-inside-setup-or-after-it-has-been-called/8751>\
**Category:** Coding Questions\
**Created:** [February 27, 2019, 4:05am UTC](https://discourse.processing.org/t/files-must-be-loaded-inside-setup-or-after-it-has-been-called/8751 "2019-02-27T04:05:01Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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:** [February 27, 2019, 10:57am UTC](https://discourse.processing.org/t/files-must-be-loaded-inside-setup-or-after-it-has-been-called/8751/3 "2019-02-27T10:57:32Z")

</div>

> [@quark](#):
>
> Images have to be loaded during or after **setup()**…

Actually they can be loaded during **settings()**: 🖼

> [@\[SOLVED\] Image() nullPtrException](https://discourse.processing.org/t/solved-image-nullptrexception/7424/6):
>
> Actually anything related to sketchPath already works as soon as settings(). Same for args[]. nerd_face

> [@File Listing Order](https://discourse.processing.org/t/file-listing-order/7148/20):
>
> Your sketch is buggy! You’re calling dataFile() before settings()! bug The private system field PApplet::sketchPath is initialized just before settings() is called back btW. calling[Processing.GitHub.io/processing-javadocs/core/processing/core/PApplet.html#sketchPath--](http://Processing.GitHub.io/processing-javadocs/core/processing/core/PApplet.html#sketchPath--)

> [@dataPath() problem under Mac OS X](https://discourse.processing.org/t/datapath-problem-under-mac-os-x/5486/3):
>
> Anything related to sketchPath is safe in settings() already. shield

---

_[View the full topic](https://discourse.processing.org/t/files-must-be-loaded-inside-setup-or-after-it-has-been-called/8751)._
