Create package function dynamically