Invoke function from module in form
I was looking for a solution for hours. Right after posting the question, i found one:

calling

\Drupal::moduleHandler()-&gt;invoke('openid','begin',array($openid,$return_to,$form_state));


seems to do the trick.

Still, I wonder why I can call user_login_finalize directly.