We focused on the use keyword in this recipe, which is really handy when your modules get deeper (which means there are a lot of nested modules and units). In short, use helps bind a long module call to a single name. In the preceding recipe, we had a nested module named deeply, where nested is the module inside deeply that has a public function named sample_function. Conventionally, we can call this function by deeply::nested::sample_function; however, using the use keyword, we can bind this to a single entity and call it in the main function, which provides much easier access. Here, we bound this path to other_function() and we also created a normal function named sample_function to understand the concept of shadowing.
We created a block inside the main function and explicitly mentioned use deeply::nested::sample_function . We also called sample_function after that. This calls the deeply module's sample_function item rather than the globally available function and the use mentioned in the block ends once it goes outside the scope. Calling sample_function outside the block will lead to calling the global function, as use is not active anymore.