# MicroPython Basics: Load Files & Run Code

## Overview

Danger: 

Warning: 

![](https://cdn-learn.adafruit.com/assets/assets/000/035/010/medium800/microcontrollers_IMG_5117.jpg?1471864392)

https://www.youtube.com/watch?v=hrjtAYMrxF4

This guide explores how to load files and run code on a MicroPython board. &nbsp;In the earlier introductions to MicroPython you manually typed all&nbsp;the code you wanted to run into the board's serial REPL. &nbsp;This process is great for learning and experimenting, but not great&nbsp;for developing and running complex programs because you have to type in the program every time you want it to run. &nbsp;However MicroPython has an internal filesystem which can store code that's run&nbsp;whenever the board powers up, just like an Arduino runs an Arduino sketch. &nbsp;Using a simple tool you can learn how to load&nbsp;code and other files into&nbsp;MicroPython's filesystem and enable an 'Arduino-like' workflow for developing code on your computer that runs on a MicroPython board.

Before you get started be sure to&nbsp;check&nbsp;your [board's documentation](../../../micropython-basics-what-is-micropython/overview?view=all#faq-10) for more details on its filesystem. &nbsp;Some MicroPython boards like the pyboard have a microSD card which&nbsp;can store large amounts of data in its filesystem. &nbsp;Other boards like the ESP8266 reserve just a small part&nbsp;of their internal flash memory for the filesystem. &nbsp;Each board is slightly different in how it creates and uses its filesystem so check your board's documentation for more details.

For this guide we'll use the **[Adafruit MicroPython tool (ampy)](https://github.com/adafruit/ampy)**&nbsp;to load files and run code&nbsp;on a MicroPython board. &nbsp;If you're curious ampy&nbsp;is not the only tool for manipulating files and more on a MicroPython board, there are several other tools&nbsp;such as:

- **ESP8266 web REPL** - For ESP8266-based boards the&nbsp;web REPL provides a basic web interface for uploading files to the board. &nbsp;This is handy for dropping a file on a board, but it requires being connected to the web REPL which might not always be convenient.
- **[rshell](https://github.com/dhylands/rshell)** - rshell is&nbsp;a remote MicroPython shell tool which allows you to access the files and more from a MicroPython board connected over its serial/USB connection. &nbsp;Check out the [rshell forum post](https://forum.micropython.org/viewtopic.php?t=708) for more details on its usage.
- **[mpfshell](https://github.com/wendlers/mpfshell)** - mpfshell is similar to rshell and provides file and REPL access in a MicroPython-specific shell. &nbsp;However mpfshell is made specifically to support ESP8266-based boards and the WiPy board. &nbsp;Check out the [mpfshell forum post](http://forum.micropython.org/viewtopic.php?f=16&t=1652) for more details on its usage.

This guide uses `ampy`&nbsp;because it is a simple cross-platform command line tool that provides just enough functionality to access MicroPython's filesystem without being too complex. &nbsp;Feel free to explore other tools and options once you learn about MicroPython's filesystem.

Also be aware `ampy`&nbsp;does not support talking to boards without a serial/USB REPL connection. &nbsp;In particular the WiPy board requires accessing the REPL over telnet and won't currently work with ampy. &nbsp;Consider using the mpfshell tool mentioned above, or even PyCom's editors and tools.

Before continuing&nbsp;make sure you have a MicroPython board and can [access its serial REPL.](../../../micropython-basics-how-to-load-micropython-on-a-board/serial-terminal?view=all#serial-terminal)&nbsp; If you're new to MicroPython start by reading these guides that explain what it is and how to get started:

- [MicroPython Basics: What is MicroPython?](../../../micropython-basics-what-is-micropython/overview)
- [MicroPython Basics: How to Load MicroPython on a Board](../../../micropython-basics-how-to-load-micropython-on-a-board)
- [MicroPython Basics: Blink a LED](../../../micropython-basics-blink-a-led/overview)

- [Next Page](https://learn.adafruit.com/micropython-basics-load-files-and-run-code/install-ampy.md)

## Related Guides

- [Adafruit Feather HUZZAH ESP8266](https://learn.adafruit.com/adafruit-feather-huzzah-esp8266.md)
- [Eye of Newt](https://learn.adafruit.com/eye-of-newt.md)
- [Adafruit IO Time Tracking Cube](https://learn.adafruit.com/time-tracking-cube.md)
- [Adafruit IO Home: Lights and Temperature ](https://learn.adafruit.com/adafruit-io-house-lights-and-temperature.md)
- [Adding a WiFi Co-Processor to CircuitPython](https://learn.adafruit.com/adding-a-wifi-co-processor-to-circuitpython-esp8266-esp32.md)
- [Using Crickit and Adafruit IO together](https://learn.adafruit.com/crickit-and-adafruitio.md)
- [Adafruit IO Home: Security ](https://learn.adafruit.com/adafruit-io-home-security.md)
- [Boomy The Boombox](https://learn.adafruit.com/boomy-the-boombox.md)
- [CircuitPython 2FA TOTP Authentication Friend](https://learn.adafruit.com/circuitpython-totp-otp-2fa-authy-authenticator-friend.md)
- [Adafruit IO Basics: ESP8266 + Arduino](https://learn.adafruit.com/adafruit-io-basics-esp8266-arduino.md)
- [Easy Alexa (Echo) Control of your ESP8266 Huzzah](https://learn.adafruit.com/easy-alexa-or-echo-control-of-your-esp8266-huzzah.md)
- [Adafruit IO Environmental Monitor for Feather or Raspberry Pi](https://learn.adafruit.com/adafruit-io-air-quality-monitor.md)
- [Introducing Adafruit Feather](https://learn.adafruit.com/adafruit-feather.md)
- [Native MP3 decoding on Arduino](https://learn.adafruit.com/native-mp3-decoding-on-arduino.md)
- [Pinball Controller for iPad](https://learn.adafruit.com/pinball-controll-ipad.md)
- [Mini-Guide: Getting Started With The WiPy Board](https://learn.adafruit.com/micro-guide-getting-started-with-wipy-board.md)
