Python-CPP Interoperativity: Accessing TTree generated by external macros in python (conda environment)

I am writting an external macro that looks like this:

TTree* t2(string fname, int num){
	cout << "file number: "<< num << endl;
	TTree* tree=new TTree(fname.c_str(),"tttname");
	return tree;
}

Then in jupyterlab, I run ROOT.gROOT.ProcessLine('.x ./t2.C("hhh",465)')
What I want is that this macro return a <cppyy.gbl.TTree object at 0x55b9c272f920> object in python so i can readily access it.
Instead, the macro return the address (which is a hex converted to int), this makes the access of the object not straightforward (as i need to get back the object by its address). (see figure)
image

Is there any tweak to the macro so that I can do the thing in a more straightforward way ?


_ROOT Version: 6.24 (PyROOT via conda)
_Platform:Centos7
_Compiler: gcc9


Update:
I found the solution. When I execute the code, it is in ROOT environment, so the adress is returned. For this case, I need to manuall do the binding to python object for the address. (see figure below)

However the external function has already reside in the ROOT environment, with python proxy created by cppyy. Therefore, if I invoke the function, the fuction returns the TTree as a python object. (see figure below)

image