Module 1:
```
local p = {}
function p.main()
local title = mw.title.getCurrentTitle()
title.fragment = 'a fragment'
return 'The fragment is: ' .. title.fragment
end
return p
```
Module 2:
```
local p = {}
function p.main()
local title = mw.title.getCurrentTitle()
return 'The fragment is: ' .. title.fragment
end
return p
```
Module invocations:
```
{{#invoke:Module 1|main}}
{{#invoke:Module 2|main}}
```
The fragment property persists across the two #invokes, giving the output:
```
The fragment is: a fragment
The fragment is: a fragment
```
I've made example modules [[ https://test.wikipedia.org/wiki/Module:User:Mr._Stradivarius/fragment1 | here ]] and [[ https://test.wikipedia.org/wiki/Module:User:Mr._Stradivarius/fragment2 | here ]], and an example invocation [[ https://test.wikipedia.org/wiki/User:Mr._Stradivarius/Title_object_fragments | here ]].
This only happens for title objects fetched with `mw.title.getCurrentTitle`. Fragments don't persist across #invokes for title objects made with `mw.title.new`, even if the title is for the current page.