I have a second laptop running kali linux which is not used at all, meaning it can be running anytime as a server for my application. So what I actually want to do is connect from my application to my server and send some data, on the server run a python program that uses this code and return some data back. I never tried to work with servers, can I even turn my computer into a server for my application? does this cost any money? can I run a python code on the server and return the results?
I know I haven't published any code but I actually don't know how to start this project and I can use some help so can someone refer me to something to start with? Thanks..
Your problem is not Android-related definitely.
You simply need to educated yourself about networking. Yes, it will cost you some money - you spend them buying few books and some hardware for building home network.
After about 3-6-12 months of playing with your home network you will find your question rather simple to answer.
Using a server in android to run code