SQLite Forum

Bad practice to open AND attach the same database?
Login
If you update the database using one name and select from it using the other name in the same transaction, you'll get a SQLITE_LOCKED error no later than when you try to commit.

If you update the database using both names in the same transaction, you'll get a SQLITE_LOCKED error on the relevant statement.

If you do BEGIN IMMEDIATE TRANSACTION, you'll get a SQLITE_LOCKED error immediately.

Summary: don't.  If you use an in-memory main database, you can safely attach whatever set of on-disk databases you need (each one at most once).