Python Persistent Variable In Function R