Import only when code used?

if we’re talking about loading python pkg on the fly specifically, what I like to do is something like

function initialize()
    rospy = pyimport("rospy")
end

otherwise you just have to do it in __init__() of your package