This is a solution for python, using noweb syntax. It saves all open matplotlib figures, but the idea can be extended easily. First off, make sure noweb is enabled in settings. Then, define a function which returns a list of filenames.
#+name: plt-save #+begin_src python :exports results :results verbatim idx = get_fignums() files = [] for i in idx: figure(i) files.append('{0}_{1}.png'.format(path, i)) savefig(numbered[-1], bbox_inches='tight') return "\n".join(["[[file:{0}]]".format(f) for f in files]) #+end_src
Then, in the block where the figures are to be saved, define a variable path, call <<plt-save>>, and set the results to verbatim.
#+begin_src python :results verbatim # Do processing here# path='features_heatmap' <<plt-save>> #+end_src