As a starting point, look into Kubernetes client libraries - since you're using python, that one: https://github.com/kubernetes-client/python . Keeping in mind exec/attach support is problematic.
Copying files into a container, you have the following thread on SO: Copy file from pod to host by using kubernetes python client . I'm not sure in-container direct edition would be easy / better pull your existing configuration if needed, then overwrite it.
Also consider using a ConfigMap, configuring your workload. Then, you could either trigger a restart of your Pods, when that configuration is changed, or look into something better ... Prometheus ships with the prometheus config reloader: a sidecar, that would watch for changes to some ConfigMaps, installs the last copy on a volume that would be shared with your main application, then send some signal instructing that application to re-read its configuration...