How to call wp_localize_script() after the script?

Well, you have to call wp_licalize_script after registering the script, because you need handle of that script… And of course you can’t localize something that doesn’t exist…

Here’s some example:

if ( !function_exists('pt_scripts') ):
    function pt_scripts () {
        wp_register_style( 'style', get_stylesheet_uri(), null, '1.3.1', 'all' );
        wp_enqueue_style( 'style' );
        wp_register_script( 'scripts', get_template_directory_uri() . '/script.js', array('jquery'), '1.3.0', true );
        wp_enqueue_script( 'jquery' );
        wp_enqueue_script( 'scripts' );

        wp_localize_script( 'scripts', 'ScriptsData', array(
            'some_data_1' => 'data1',
            ...
        ) );  // 'ScriptsData' is name of object that you can access in your JS
    }
endif;

add_action( 'wp_enqueue_scripts', 'pt_scripts' );

PS. ‘scripts‘ is not the best name for script handle – it’s pretty easy to get some conflicts with such names.