How to pass variable from module to other theme I would like to pass variables from my custom module to some of my custom themes.
The most tutorials are concerning using hook_theme function but as I understand, it works only for creating new theme functions (new tpl files) inside module, where the hook_theme is defined. But I would need to alter theme definition of some custom theme in 
/sites/all/themes folder from my custom module
/sites/all/modules

In particular, I need to add a variable into thems's html.tpl.php file. I would like to use custom module to define variable, because I need to make database queries to fill variable with value, and db queries should not be done in theme.

I have tried implementing hook_theme_registry_alter.
I have tried to add variable like this:

function mymodule_theme_registry_alter(&amp;$theme_registry) {
$theme_registry['html']['variables']['test'] = 'test value';
}


but I got error "Undefined index: #children in template_process_html"

Can anybody help?
For your needs, you'll need to create a custom module and implement hook_preprocess_html:

function hook_preprocess_html(&amp;$vars) {
  // This is where you do the db query
  $myvar = _get_my_var(); 

  // After this $myvar will be available in html.tpl.php
  // where you need to print it out
  $vars['myvar'] = $myvar;
}