Can a package detect whether it was imported in the REPL vs inside another package?

module MyPackage
function __init__()
    if !isinteractive()
        error("MyPackage is intended for interactive REPL use only.")
    end
end
end

This won’t prevent OtherPackage from accidentally making MyPackage a dependency, but at least would break OtherPackage’s CI, thus also preventing it’s registration.