Use of exported variable

i have to use the exported variable from one script into another script

ex :
A.ksh

      
            # !/bin/ksh
               chk1=56
               export chk1
 
B.ksh
    
              # !/bin/ksh
               echo $chk1
 
 

i have executed the A.ksh then B.ksh but nothing is displayed.
could some one tell the correct procedure to do this export?

thanks

source A.ksh inside B.ksh:-

# !/bin/ksh
. ./A.ksh
echo $chk1

the target is to use the variable of A.ksh into B.ksh .
because the same variable can be used differently in both the script and
in real time both the script will run pararlly and one script can not call other.

Variables defined in a script belong to that script, so when you start a new script it uses a new set of variables. So I don't think if there are any other option other than sourcing. But please don't consider my opinion as final, somebody else in this forum will have a solution.

Write variable to file, then read it in other script.

an12:/home/vbe $ echo $VAL   # VAL not set yet...

an12:/home/vbe $ echo $$
14811192                              #Begin SHELL PID
an12:/home/vbe $ ksh             # New SHELL
an12:/home/vbe $ echo $$
22544394                               # New SHELL PID
an12:/home/vbe $ export VAL=2:echo      # Variable VAL set now...
an12:/home/vbe $ echo $VAL
2:echo
an12:/home/vbe $ ksh             # Second New SHELL
an12:/home/vbe $ echo $$
21561462                                       # See PID is different...
an12:/home/vbe $ echo $VAL
2:echo                                   # And yes the variable was exported, so it this here...
an12:/home/vbe $ echo $$
21561462
an12:/home/vbe $ exit
an12:/home/vbe $ echo $$
22544394
an12:/home/vbe $ echo $VAL
2:echo
an12:/home/vbe $ exit
an12:/home/vbe $ echo $VAL    # Back to begin SHELL where has no knowledge of this variable...

an12:/home/vbe $ echo $$
14811192
an12:/home/vbe $

There is no need to export a variable if one is only sourcing the other file. Variables are exported so that they work if one script calls another script in a subshell:

A.ksh:

#!/bin/ksh
chk1=56
export chk1
./B.ksh
$ ./A.ksh
56

If the scripts are to be run in parallel then you could use a third script, export the variable there and run both scripts in parallel in the background..
Or you can have a third file, set the variables there, and source the file in either script. You only need to export those variables if those scripts in turn call other scripts in a subshell that need that variable...

--
As a side note. The shebang #! only works if there is no space between the two characters, otherwise it is just a comment.