Skip to content
Flint Help Center
Open Flint

How do I add code to Flint?

Write or paste code into Flint's built-in editor, run it, and send the code and its output to Sparky.

Updated October 8, 2026

Flint has a code editor built into the message box, so you can hand Sparky a snippet to explain, debug or extend — and run it first if you want to show what it actually does.

Add a snippet

  1. In a chat or conversational activity session's message box, click Write code. A code editor opens next to the conversation and the snippet is attached to your message.
  2. Pick the language from the dropdown in the editor's top bar. It starts on Java, and after that Flint offers whichever language you chose last.
  3. Type or paste your code.
  4. Send the message, and ask your question in the same message — "why does this return None?", "walk my students through what line 7 does".

The snippet stays attached to that message, so Sparky can quote it back and suggest changes line by line.

Run it before you send

Some languages can be run inside Flint. The dropdown marks those with a small play symbol, and picking one puts an Execute button next to it in the top bar.

  1. Click Execute.
  2. The Output panel opens underneath with whatever the code printed, returned or raised. Hide and Show collapse and reopen it.
  3. Run it again after an edit and the new output replaces the old one.

Whatever is in Output when you send the message goes to Sparky along with the code, which is what makes "here's the error I get" a question Sparky can actually answer.

Where it works

The editor also works in a Lesson with Sparky activity's manual builder. You need Can edit access: open Edit activity → the activity thumbnail → Activity settings → Activity behavior.

  • Attach code to Sparky's greeting message to give students the same visible starter code when they begin a session.
  • Attach code to Guidelines for Sparky when it should guide Sparky rather than appear as a student-facing starter attachment.

Click Update activity to save. These fields have no Send action; their attachments are saved with the activity.

For the other things you can attach to a message, see Uploading content to Flint.

Watch it

This walkthrough was recorded in 2023 on an interface Flint has since retired, and it finishes by inserting the code into the message as plain text, which is not how it works now. Follow the written steps above; a new recording is on the way.