Serial Communication works only when serial monitor is active

Since you have not posted any of the code you are using all I can do is suggest you look at this Python - Arduino demo

...R