Delete an account

davidread's Avatar


12 May, 2017 03:58 PM

I an using the Python Interpreter in Moneydance 2017.2 (1597) and trying to delete an account like this:

rootAccount = moneydance.getRootAccount()
rootAccount.removeSubAccount(rootAccount.getAccountByName('Current'), True)

but it complains with:

Error running script: Traceback (most recent call last):
  File "D:\Projects\AutoIt\", line 13, in <module>
    rootAccount.removeSubAccount(rootAccount.getAccountByName('Current'), True)
AttributeError: 'com.infinitekind.moneydance.model.Account' object has no attribute 'removeSubAccount'

Can you tell me what I'm doing wrong?

  1. Support Staff 1 Posted by Sean Reilly on 12 May, 2017 09:14 PM

    Sean Reilly's Avatar

    Hi David,

    Ah yes, in order to delete an account you'll need to call the .deleteItem() method on that account. Please make sure that there are no transactions (including in reminders) or subaccounts that may still refer to that account though.


    Sean Reilly
    Developer, The Infinite Kind

  2. 2 Posted by davidread on 13 May, 2017 05:24 PM

    davidread's Avatar

    Thanks Sean,
    The .deleteItem() works, but unfortunately doesn't delete its' subaccounts.
    I'm migrating from Quicken and want to delete the default accounts and
    categories. I can iterate through them though.

    So is the documentation for .removeSubAccount() wrong, or what?

    Kind regards,

    David Read.

  3. Support Staff 3 Posted by Sean Reilly on 21 May, 2017 09:08 AM

    Sean Reilly's Avatar

    Hi David,

    Ah yes, that method is not public so it's not supposed to be exposed, however that doesn't matter to the Python interface as it uses reflection to find and invoke methods. That method also shouldn't be appearing in the API documentation, but I believe it does have a "caution" note in it to indicate that orphan transactions (not to mention accounts) could result as it's supposed to be a behind the scenes method used for keeping the account hierarchy up-to-date.

    From the Python API there is a non-published method that I can't see us changing anytime soon that you could use:

      moneydance.getUI().deleteAccountAndAllReferences(Account account_to_delete);

    There is no GUI confirmation on it, but it will delete the given account and all references, including sub-accounts/categories, transactions, reminders, etc.


  4. System closed this discussion on 20 Aug, 2017 09:10 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac