What is the difference between "package" and "module" in Kotlin?
Short answer: packages collect related classes, and correspond roughly to directories; while modules are a much higher level and correspond to projects and/or compiler runs.
Longer answer:
In Java and Kotlin, classes are arranged into packages. They're set using the package
directive at the top of each file. (In Java, this corresponds exactly to the directory structure in which they're stored; that's common in Kotlin too, though not strictly required.)
They provide a way of grouping related classes: you can refer to classes (and top-level functions and fields) in the same package directly, while all other classes need to be import
ed, or their fully-qualified names (package.package…class) used. And in the most recent versions of Java, you can ‘seal’ a package, which means no-one else can add classes to it later on.
Modules, on the other hand, are new to Kotlin. They are a much higher-level concept, collecting together all the classes in a program or library. (Some IDEs and tools call this a ‘project’ or ‘source set’.) All the files in a module must be compiled together, and the results are usually collected into a .jar (or .war) file.
A big system might consist of a handful of modules, but each of those could contain many tens of packages.
More specifically, a module is a set of Kotlin files compiled together. and it is on top of packages. Packages on the other hand, are folders that groups related classes.