Publishing is about sharing, so let's have a look at how to publish something other than by printing.
import osimport datetimeimport pyblish.apiclassCollectUserDir(pyblish.api.ContextPlugin): order =0defprocess(self,context): context.data["userDir"]= os.path.expanduser("~")classWriteTime(pyblish.api.ContextPlugin): order =1defprocess(self,context): user_dir = context.data["userDir"] destination_path = os.path.join(user_dir, "time.txt")print("Writing time to %s"% destination_path)withopen(destination_path, "w")as f: f.write("The time is %s"% datetime.datetime.today().ctime())pyblish.api.register_plugin(CollectUserDir)pyblish.api.register_plugin(WriteTime)import pyblish.utilpyblish.util.publish()# Writing time to C:\Users\marcus\Documents\time.txt