Set a session when page is loaded I want to define a session in contributed module (field collection module) in drupal 7 when the page is loaded. 

This session takes a value from the URL and fill one of the field that depend on it. I defined a session in the form_alter function but I need to refresh the page to let the session take the value? So, could anyone tell me where I can define it? In which function of the module?
You can use the session that Drupal creates. Just add your data to an element of the $_SESSION variable:

$_SESSION['my_module']['some_key'] = 'some value';


It will