I had a quick look at this in limabean, and it's easily done for sure.

But there seems to be one hard problem:  the tag and metadata context prior
to inclusion in each place may differ.  In my quick implementation, only
the first is honoured.  Which is a bit of a dirty hack, eh?


pushtag #included
include "include-duplicate/included.beancount"
poptag #included

pushtag #duplicate-include
include "include-duplicate/included.beancount"
poptag #duplicate-include

results in:

2023-05-31 * "Include some beer" #included
  Assets:Bank:Current -15.30 NZD
  Expenses:Entertainment:Drinks-and-snacks

2023-06-01 * "Inclusion is everything" #included
  Assets:Bank:Current -5.65 NZD
  Expenses:Groceries

Oops, missing that #duplicate-include tag.  🤷

On Tue, 3 Mar 2026 at 13:55, Timothy Jesionowski <
[email protected]> wrote:

> I would love for that restriction to be removed. Never thought about
> patching it myself, I hope there's no deep architectural reason for that
> constraint?
>
>
>
> Sincerely,
> Timothy Jesionowski
>
> On Mon, Mar 2, 2026, 6:32 PM Aaron Stacy <[email protected]> wrote:
>
>> The beancount loader has an error if a file is imported multiple times (
>> code
>> <https://github.com/beancount/beancount/blob/eb8be17c750257dc693e3173c30d2cabc9ab2faa/beancount/loader.py#L440>
>> ).
>>
>> I noticed because I was trying to organize my ledger something like this:
>>
>> [image: ledger_deps.png]
>>
>> And got the error. I want each of banking.beancount and income.beancount
>> to include accounts.beancount because my editor plugin will give me errors
>> if I don't (since the accounts aren't defined).
>>
>> Looks like this functionality has been around just about as long as the
>> include directive (commit
>> <https://github.com/beancount/beancount/commit/1ad7017ca8bba9af7e13ed6613c28f14126b0ea7>),
>> and I couldn't find any docs on why this would be an error.
>>
>> When I remove the error, the loading logic seems to work fine. Any chance
>> I could mail a PR to remove this error?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Beancount" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion visit
>> https://groups.google.com/d/msgid/beancount/CACjABknxqNpEK0EgQK7PVh76sUkO41hF%2B6QxSTR91D6U9Z4kag%40mail.gmail.com
>> <https://groups.google.com/d/msgid/beancount/CACjABknxqNpEK0EgQK7PVh76sUkO41hF%2B6QxSTR91D6U9Z4kag%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Beancount" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/beancount/CAOVsoWTJbV6JW62Toq-mttgL1qRzi8oaKNDS%3D9dTxt6Pt0ZXfA%40mail.gmail.com
> <https://groups.google.com/d/msgid/beancount/CAOVsoWTJbV6JW62Toq-mttgL1qRzi8oaKNDS%3D9dTxt6Pt0ZXfA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/beancount/CAFhGSbtPVSq0ZXg7pXprGkgi-h5SnkU%2BVC4MizdEg3wWD8%3DLug%40mail.gmail.com.

Reply via email to