OK I have solved it.
After searching everywhere and finding nothing.
Step 1. Call kernel32.dll -> WTSGetActiveConsoleSessionId to get console session id.
Step 2. use jedi library function jwsclToken.JwGetProcessLogonSession to get process session id.
Step 3. if( console session = process session ) or ( process session is zero )then VICTORY!!!!
2 days of in depth searching to get the result.