When it encounters the module/1 directive, the compiler first erases previous contents of this module, if there was any, before starting to compile predicates into it. This means that if the contents of a module has to be generated incrementally, the module directive cannot be used because the previous contents of the module would be destroyed. In this case the predicate compile(File, Module) should be used.