In reply to Aravind2020:
You did not show where these functions are declared, but I’m going to assume they are not methods of a class. In that case, k is a static variable and j is an automatic variable. All variables declared in procedural blocks of code have default static lifetimes with the exception of variables declared in class methods, or declared as for-loop iterators. This is for backward compatibility with Verilog.
Your first problem is you are not allowed to declare an initialization on a static variable in procedural block without declaring the variable explicitly static. This is because as you did not realize, everybody assumes the variable is automatic and gets initialized each time through the loop. Static variables get initialized once before time 0. You do not want k to be static, you want it automatic just like dbg is. The easiest thing to do is declare abc as an automatic function, or the package as an automatic. Then every variable declared in procedural blocks becomes automatic; you don’t have put it on every variable declaration.
The second problem is the error message you are getting is misleading. You cannot initialize a static variable using automatic variables because the initialization happens at time 0, not when the function gets called, and the automatic variable does not exist. But you do not want k to be static anyways.