How do you deploy a proxy within a proxy (UUPS)?

Hey there!

I have been succesfully doing the following inside my VehicleManufacturer.sol contract:

function createVehicleProxy(uint16 _number, bytes32 _seriesName)
    returns (address)
    require(!isTaken[_seriesName], "This name is already taken");
    address vehicleClone = ClonesUpgradeable.clone(VehicleTemplate);
    ERC1967Proxy VehicleProxy = new ERC1967Proxy{ value: msg.value }(

Its been able to create Vehicle contracts for me and use/modify state variables via the VehicleProxy that gets created.

Now, I am trying to enable a Enterprise.sol contract to create VehicleManufacturer proxies in the same way. This is how I have been trying to do so:

function createVehicleManufacturerProxy(bytes32 manufacturerName)
    returns (ERC1967Proxy)
    require(!isTaken[manufacturerName], "This name is already taken");
    address manufacturerClone = ClonesUpgradeable.clone(ManufacturerTemplate);
    ERC1967Proxy manufacturerProxy = new ERC1967Proxy{ value: msg.value }(
    return organizerProxy;

The Enterprise.sol contract is indeed able to create a manufacturerProxy. Checking this brand new manufacturerProxy, everything seems to be fine. Variables exists and can be modified just as when it was not a proxy. The problem is that now my VehicleProxy is broken. The proxy that use to work fine previously has no control over any of the state variables defined in VehicleTemplate. i.e All the variables stay as default and calling the functions defined in the implementation just make empty fallback calls from this manufacturerProxy (that used to work when not being a proxy).

Is it not possible to create nested like proxies? What the best way to do it? practices...any guidance will be much appreciated!

Turns out that I had editted my VehicleManufacturer.sol to define the templates outside of my Initialize function. Thus, when I was triggering the createVehicleManufacturerProxy, it was not able to get the manufacturerClone correctly because as Documentation explains: you should "Make sure that all initial values are set in an initializer function".