Can I call a method in pry from a rake task?

I have a rake task that starts a pry session called 'console'. I want to create a new task that calls 'console' and then calls a method 'Customer.visit' in my pry session.

My code looks like

task :console do
  sh "ruby bin/run.rb"

desc "Runs an interactive tutorial."
task :test do
  sh "Customer.visit"

This returns an error of

rake aborted!
Command failed with status (127): [Customer.visit...]

I think it has to do with me running "Customer.visit" with a sh command.