In ArcGIS Pro 3.3.1, I have a bunch of layouts that each contain a text box with dynamic text showing the last export date. When I export the layouts individually using Share > Export Layout, this dynamic text updates to today's date (as expected).
However, I want to export multiple layouts at once, to save me having to go through each one and manually export them. The following script works (as in it exports all my layouts at once) but it does not update the dynamic text.
import arcpy,os
aprx = arcpy.mp.ArcGISProject("CURRENT")
for lyt in aprx.listLayouts():
lyt.exportToPDF(os.path.join(r"<INSERT FOLDER PATH>", f"{lyt.name}"), clip_to_elements=False)
Is there something I can add to the script to make it update the dynamic text, or is this a bug and should be updating it? I would've thought exportToPDF is what the Share > Export Layout also uses and would therefore work in the same way. I've also tried it with exportToTIFF, exportToJPEG, exportToSVG, and exportToPNG and none of them update the dynamic text either.
I've also looked at the bug fixes for the versions after 3.3.1 and cannot see anything that addresses this issue.
This functionality has now been logged as an enhancement request:
Enhancement ENH-000174302 Provide a method for bulk exporting of layouts in ArcGIS Pro that are not in a map series.
In the end I couldn't get the dynamic text to update, but instead used the re.sub function from the re module to substitute the dateExported dynamic text element with the current date (using datetime module). This means for subsequent exports the dateExported dynamic text is not present anymore, so then have a re.search function to find the date text and replace that with the current date.