Importing From Your Own Files
Dev’s Python tool keeps its parsing in readings.py, so Asha can reuse it for the sports hall’s
boiler. digest.py, the file next to it, starts with one line that imports three functions from
it:
from readings import is_blank, parse_line, summarise
The school’s new dashboard is written in JavaScript, so the tool is moving too. Does that one line still work?
In Python, readings.py shares every top-level name without saying so. A JavaScript file shares
only what it marks with export. So far, only parseLine() has moved across to readings.js,
and its declaration starts with that word (its body is folded here, as in the video):
readings.js
export function parseLine(line) {
…
}