2 respuestas
Attachments and Files are objects that are related to the original record, and you can't relate another object until the original record has been inserted into the database...in other words, you have to create and save the record, then attach the file.
You can however do this in the after trigger, if you write an after trigger you get the ID of the record which is Project Document in your case and then do an SOQL to look for Attachments with this parentId or Files with this ContentDocumentLink.