In CodeBook there is a check with "import" such that a package is local "_is_local(module)" and if not, they are not allowed, with the error "RefiImportError: module 'X' is restricted".
In this case I have my package "core" and "defs" is a module within it (see screenshot below).
I have contacted support and they suggested asking here.
(Apologies for the choice of forum - there's no "CodeBook" or similar.)
I received a reply from support and the CodeBook dev team:
Package importing is restricted (hence the error) but module importing not.
Therefore, one must keep the module files all in the same directory (local) and import them.