How do I install modules using a module? I wanted to install few modules when my module is installed. How can this be achieved?

I am creating a module which requires few other modules to be installed. I want to install them when my main module is installed. 

I have placed all those module folders inside one main folder, and I want to create an install file to install those modules when this main install file is executed.
If there are modules from which your module depends, your module should declare them as dependencies, in its .info file. Supposing that your module is my_secret_module.module, and it depends from first_module, and second_module, my_secret_module.info should contain the following lines.

// Drupal 5
dependencies = first_module second_module

// Drupal 6, Drupal 7, and next releases
dependencies[] = first_module
dependencies[] = second_module


In this way, your module cannot be enabled of the other modules are not enabled too.