You can select a function that you want to move to a scratch file and press . The created scratch file includes this function with all the dependencies.