SOLVED Getting cache of a Python Generator under a Python Generator

Hi all,
using a python generator as a source for another python generator can be helpful for prototyping. But I'm having trouble getting the cache of the child generator.

GetCache always returns me "None", and using current state to object also returns "None".

This is a code sample:

def main():
    obj = op.GetDown().GetClone()
    print obj.GetCache()
    return obj

I tried to see if it has children or siblings with GetDown or GetNext but I get:
"AttributeError: 'NoneType' object has no attribute 'GetDown'"

Code with current state to object:

def currentState(obj) :
    return c4d.utils.SendModelingCommand(c4d.MCOMMAND_CURRENTSTATETOOBJECT,[obj],c4d.MODELINGCOMMANDMODE_ALL,c4d.BaseContainer(),doc)[0]

def main():
    obj = op.GetDown().GetClone()
    collapsed = currentState(obj)
    print collapsed.GetChildren() //returns []
    return collapsed

In the docs there is a recursion function for the cache but I'm not sure how to use it.

I'm trying to understand what I'm doing wrong, are there suggestions on how to achieve this?
Here is a sample file:
python_under_python.c4d

Update:

def main():
    obj = op.GetDown().GetCache().GetClone()
    print obj
    return obj

getting the cache before cloning does seem to work, I couldn't see the object as it was off screen before.
Still it opens some questions such as why the clone didn't initially work; I assume I needed to insert it into the doc, which I had tried without much success (crashed cinema when I tried to evaluate the doc).

In any case, the problem seems solved for now.

Hi @orestiskon SendModelingCommand and especially CurrentStateToObject need the object to be actually in the passed document.

So you need to create a temporary doc and use it to operates.
As bellow:

import c4d

def currentState(obj) :
    return c4d.utils.SendModelingCommand(c4d.MCOMMAND_CURRENTSTATETOOBJECT,[obj],c4d.MODELINGCOMMANDMODE_ALL,c4d.BaseContainer(),obj.GetDocument())[0]

def main():
    # Retrieve the python generator
    obj = op.GetDown()
    if obj is None:
        return

    objClone = obj.GetClone()
    if objClone is None:
        raise RuntimeError("Failed to clone the object")

    # Make the children Python Generator disapear
    obj.Touch()

    # Creates a temporary document that will be used to evaluate the cache of the object
    tempDoc = c4d.documents.BaseDocument()
    if tempDoc is None:
        raise RuntimeError("Failed to create a temporary doc")

    # Inserts the child python generator that exists only in memory into our tempo doc
    tempDoc.InsertObject(objClone)

    returnedObj = currentState(objClone)

    return currentState(objClone)

Cheers,
Maxime.