Accessing a NAS device from Python code on Mac-OS
If you want to mount the network volume (or make sure that it is mounted) from the python code, then you could use the shell command mount, from inside an os.system() call. See this answer.

Once mounted, you can access the contents of the drive like any other connected drive with a filepath under /Volumes.
It is likely to be something like:
/Volumes/My\ NAS/path/to/file (where "My NAS" is the name of your share.)

Note that whether the Finder shows the drive under "Devices" or "Shared" is irrelevant.

If you need to find the filepath for a given item on the NAS, use Command Alt C in the Finder to copy the filepath to the clipboard as text.

If the correct path still isn't working in your python, then we need to see your python code.