Can I call data from within a function?

Can you call data from inside a function? Basically my contracts minting function requires the user to input their tokenIds owned from another contract to mint a new nft(s), I want to replace this parameter with a _mintAmount to make it more user friendly but to also call the other contracts tokenids within the function so they can still mint 1 for 1 from the new contract

function OGmint(uint[] calldata gimpiesTokenIds) public payable {
        uint numGimpiesGen2 = gimpiesTokenIds.length;

        require(_openMint == true, "Minting is currently not open");
        require(tokenIdTracker.current() <= max_supply, "All tokens have been minted");
        require(
            tokenIdTracker.current() + numGimpiesGen2 <= max_supply + 1,
            "Tried to mint too many"
        );
        require(msg.value >= ogPrice * numGimpiesGen2, "Amount sent is incorrect");

        for (uint i=0; i < numGimpiesGen2; ++i) {
            uint tokenId = tokenIdTracker.current();
            uint gimpTokenId = gimpiesTokenIds[i];

            require(
                _theGimpies.ownerOf(gimpTokenId) == msg.sender,
                "Caller is not owner of that Gimp"
            );
            require(
                hasGimpieGen2[gimpTokenId] == false,
                "This Gimp has already minted a new toy"
            );
            tokenIdTracker.increment();
            _safeMint(msg.sender, tokenId);
            _setTokenURI(
                tokenId, string(abi.encodePacked(tokenId.toString(), _baseExtension))
            );
            hasGimpieGen2[gimpTokenId] = true;
        }

        _wallet.transfer(msg.value);
    }