Fix self import for Python wrappers

If anyone has an easier way to implement this, please do.