wp-cron function not running when activating the cron by form submit

I figured it out.

I had used the function obs_daily_cron_fn() inside the function obs_plugin_fn(). So the function was not triggered untill the plugin page is opened.

Now moving the function obs_daily_cron_fn() out of the function obs_plugin_fn() works perfectly.