Creating package and modules through scripting

Hello, I’m wondering if there is a way to create packages or modules through Jython scripting? I know that from the script console all the packages and modules are accessible as objects, and the module objects has properties exposing the contained code: is there also a way to “write” new module and/or package objects?