Is there a way to enable a Jetpack module via `functions.php`

Third party plugins (yeah, including jetpack) are off topic on WPSE, but well, here you go: Jetpack has a filter jetpack_get_available_modules, which lets you edit the array of active modules. You can disable a module by unsetting it from the array, or enable it by adding it. Here’s how to enable a single module, ‘sharedaddy’:

function wpse248480_filter_jetpack( $modules, $min_version, $max_version ) {
    if (!(in_array('sharedaddy',$modules))) $modules[] = 'sharedaddy';
    return $modules;
add_filter( 'jetpack_get_available_modules', 'wpse248480_filter_jetpack', 20, 3 );


The above only filters the available modules. To actually (de)activate them programmatically use (source):

function wpse248480_activate_jetpack () {
  // Jetpack::deactivate_module('sharedaddy');