Adding value in variable of imported contract

Below is a simple contract which I wrote

//SPDX-License-Identifier: MIT
pragma solidity 0.8.17 ;  

contract Num
    uint256  public  nuu ;   


Below is another contract which I wrote

//SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import "./Num.sol";

contract Put
    Num[] public deploy ;
    function putfac() public               // creating and adding new instances of contract into array 
    {   Num dd = new Num() ; 

    function putvalue(uint256 serial , uint256 numput)  public  
        Num ss = Num(deploy[serial]);
        ss.nuu = numput ;                                // trying to put value into variable of another contract

In 2nd contract , I imported the contract Num , and then I created an array of that contract type , created instance and now in function putvalue I am trying to add value in variable, however I am getting these errors:-

Can anyone tell me , why these errors are showing , how to remove them and how to add value in variable nuu from 2nd contract ?

You have to call a function in the first contract that updates that value. You have two different contracts now and you call a function in the other contract if you want to change a value. You have to add that function to the first contract.

Is it not possible to update value directly. I have made the variale public in first contract. There should be some way. Or like in documenttation , I am not able to find any rule which states that value canโ€™t be changed. It is public variable , it should be possible somehow .

On what documentation you are referring. You have to call a function on chain to change that value.

A variable being public doesnโ€™t mean that anyone can change it anytime

official solidity documentation

There are 2 different contracts at that time. It is not the same as changing a variable in current contract.

this ss.nuu appears to be a public view function that returns (uint256) and your trying to give it value of numpu which is a uint256

if any contract could just openly access write functions to public variables on any smart contract that would pose as a major security hazard.

you could create a setter function on the contact Num and externally call it on your other contract.