I have been trying to update and package a template using Pro 3.1 that includes a couple of .pyt toolboxes. The toolboxes are stored in a different folder but are added to the project. I can run the toolboxes fine but when packaging the template if I choose to include toolboxes it fails almost every time. Randomly sometimes it will work even if I haven't made any changes to the toolbox or project. The only change in the Create Project Template tool that makes any difference is checking/unchecking the Include Toolboxes option. Analyze works every time no matter what. I can copy and paste the path from the error logs and the file is there, path is correct, and it opens in VS code with no problems. If I remove the PYT from the project and instead add it as an attachment it will copy it into the userdata folder with no trouble.
It doesn't complain about the other PYT file include in the project, which comes first alphabetically in the catalog but I'm not sure if it just isn't making it that far or not. Below are the lines from the log that indicate the error. I've replaced the filenames with examples, but there are no spaces or special characters other than underscores. Sometimes it does package successfully with no changes to the paths or filenames.
Has anyone else had this issue or know of a fix?
D:\PATH\PROJECT.aptx 131 ProjectPackage 2023-09-27 12:43:37 Status: Failed ErrorMessage: ERROR 000229: Cannot open D:\TOOLBOX_PATH\TOOLBOX_NAME.pyt
D:\PATH\PROJECT.aptx 131 ProjectPackage 2023-09-27 12:43:39 Status: Failed ErrorMessage: Failed to package.