Hi,


I am developing one object called py4pd to allow me to load some Python functions as objects (very similar to py/pyext). I have one problem with class_setsavefn, because I need something similar to #X declare -lib mylibrary (an extra line in a specific place in the PureData Patch file) to load the Python functions before pd tries to load the Python objects that are added by the Python module (called pd).


``` py

import pd


def mygreatfunction(x, y)

 somegreatthing(x, y)


def py4pdLoadObjects():

    pd.addobject(mygreatfunction, "py.greatfunction")


```


To do that, I am working with this function link. It works in some cases, but I have problems with undo and redo and a lot of instabilities with specific actions.


https://github.com/charlesneimog/py4pd/blob/a49dd8b1c28e3162a45a805781f7cac31197c347/src/py4pd.c#L1641



Question:

      Someone already had to add some extra lines in the pd patch in some specific order?

      What is the right way to do it? 


One observation:
      I am adding one new canvas_class method called py4pdLibrary, it loads the Python Library (the objects).


Thank you very much!


________________________
Charles K. Neimog | www.charlesneimog.com |  Universidade de São Paulo