I am looking for a way to limit how a python file to be called. Basically I only want it to be executable when I call it from a bash script but if ran directly either from a terminal or any other way I do not want it to be able to run. I am not sure if there is a way to do this or not but I figured I would give it a shot.
There is no meaningful way to do this.
UNIX process architecture does not work this way. You cannot control the execution of a script by its parent process. 
Instead we should discuss why you want to do something like this, you are probably thinking doing it in a wrong way and what good options there is to address the actual underlying problem.
Limit a python file to only be run by a bash script