How do I prevent a module from being loaded? I am developing a custom module, from this module im trying to disable other modules (for certain reasons).

Let's say I want to disable the search module, how would I do this?
See module_disable and the comments therein for how to place it within a profile.install or module.install file.