References by title (not nid) while creating nodes via PHP code does anyone know how to create node reference while creating node programmatically? I mean - using TITLE and TYPE, not nid. 

I am creating nodes via python script and user is prompted for title of parent node. Nobody's gonna tell you NID in that case. But content type and part of title should be enough. 

If there is no way of doing that in Drupal - I am gonna make my own function to fetch all nodes that fits criteria and go further if there's only one or prompt for choosing proper one if there's more than one..

I'll be happy if there's already something that handles my task.. :)

My current code with doing that by NID:

    $n = new stdClass();
    $n-&gt;type="project_release";
    node_object_prepare($n);
    $n-&gt;title = "Kaboom [".date(YmdHis)."]";
    $n-&gt;language = LANGUAGE_NONE;
    $n-&gt;uid = 1;
    $n-&gt;body[$n-&gt;language][0]['value']="12345";
    $n-&gt;body[$n-&gt;language][0]['summary']="123457890";
    $n-&gt;body[$n-&gt;language][0]['format']="filtered_html";

    $n-&gt;field_release_project[$n-&gt;language][0]['nid']=85;
    $n-&gt;field_project_release_notes[$n-&gt;language][0]['value']='AaAAAAAA...';

    $path = 'remotely_added_at_'.date('YmdHis');
    $n-&gt;path = array('alias'=&gt;$path);
    if($n=node_submit($n)) {
        node_save($n);
        echo "&lt;/br&gt;Node with nid ".$n-&gt;nid." saved\n";
    }


Cheers
I don't think that you need to write your own function, just have a look at node_reference_autocomplete_value(), this functions does exactly what you need (match Node Title to nid)