AngelScript uses magic to make it work.
Discarding a module doesn't immediately remove the module if there are still live objects or other external references to the module. It will be kept in memory until all those references are released in order to avoid dangling pointers, or other lose ends that may cause crashes in the application.
However, this also means that the re-compiled script doesn't share anything with the previous script (unless the script entities have been explicitly declared as shared). Global variables, object types, etc will be distinct for each compilation.