Help! Using Beans from command line script?

Trying to write a utility to associate imported contacts with imported accounts (using alternate account id from import. I'm getting 'Class 'Accounts' not found'  what do I need to add to the script to get it to work?

<?php

if(!defined('sugarEntry'))define('sugarEntry', true);

require 'data/BeanFactory.php';

require_once("modules/Accounts/Account.php");

$pdo = new PDO($dsn, $user, $pass, $opt);

$stmt = $pdo->query('SELECT bridge_account_id_c,id_c FROM accounts_cstm');

while ($account_row = $stmt->fetch())

  {

  echo $account_row['id_c']."\n";

  $stmt2 = $pdo->query("SELECT id_c FROM contacts_cstm WHERE bridge_account_id_c = '".$account_row['bridge_account_id_c']."'");

  while ($contact_row = $stmt2->fetch())

  {

  $bean = new Accounts();

  $bean->retrieve($account_row['id_c']);

  $bean->load_relationship('contacts');

  $bean->contacts->add($contact_row['id_c']);

  $bean->save();

  }

  }

?>