Python and Lua: coming soon

SDN · Updated 09 November 2026

SDN is not live for Python and Lua yet. How to write your script now so it is ready.

Not live yet. SDN is not available for Python or Lua scripts today. They run as local scripts only, from ~/.botwithus/scripts/python and ~/.botwithus/scripts/lua. This page explains how to write them now so they are ready when SDN opens for them.

Write your script so it is ready

Provisional: these rules may change before launch. They describe how SDN for Python and Lua is being designed today. Following them now should make moving to SDN easy, but check this page again when SDN launches.

Both languages

  • One entrypoint file that defines exactly one BotScript. In Python, one BotScript subclass. In Lua, a file that returns one script table with on_loop.
  • Plain UTF-8 source only. Ship .py or .lua source files. Compiled or native files (.pyc, .pyd, .dll, .so, .luac) are not supported.
  • Lowercase file names under one root folder. Every file sits under a single top-level folder whose name is a lowercase identifier such as myscript. File and folder names use only a-z, 0-9, _, ., / and -.
  • No dependencies on other packages. Your script may use the BotWithUs framework and the language's standard library. Everything else it needs must be inside your own folder.
  • No background event dispatcher. Do not rely on event handlers running in the background while your script does something else. Read the state you need from the snapshot each loop.
  • Avoid long tick waits. Keep each wait under 60 seconds. A tick wait longer than that fails.

Python

  • Include the __init__.py file in every package folder.
  • Imports between your own files work as usual, relative imports included. A missing module is an error; it is never looked up on disk.
  • Read data files you ship with your script through importlib.resources, not by opening paths on disk.

Lua

  • Do not use io, debug, loadfile, dofile or string.dump, and do not load native libraries. These will not be available.
  • Log with bwu.log instead of io.write.
  • Read data files you ship with your script with sdn.resource("myscript/path/to/file"), not by opening files.
  • require finds a module as name.lua or name/init.lua. Do not ship both for the same name.

Until then

Keep writing and running your scripts locally:

If you want to publish a script through the Script Market today, write it in Java.