I have found a strange effect and unsure if it is real or reflects another error elsewhere.
I used a
match xyzx:
case SSSS:
and for some reason using match disables following sub routines and stops a tool cold.
In pycharm if match case is in def execute
def postExecute cannot be executed and is grayed out.
The same for any functions outside the tool class.
Can someone else confirm this?
Cheers
Yes, this can be “real” — but it’s not that match/case magically disables subroutines. It’s almost always one of these two things:
Python version mismatch
match/case only works in Python 3.10+. If your geoprocessing tool is running under an older ArcGIS Python (common if you’re not actually using Pro’s arcgispro-py3 env), the script won’t compile cleanly and execution can stop before postExecute ever runs. Pycharm may also gray out code if it thinks the file won’t parse under the selected interpreter.
Structural pattern matching gotchas
A small syntax/indentation error in the match block (or a case _: that exits early) can make the flow look like “everything after is ignored”.
Quick sanity checks:
Print the runtime version inside execute():
import sys
arcpy.AddMessage(sys.version)
If it’s < 3.10, that’s the root cause.
Confirm your tool is using ArcGIS Pro’s Python environment.
If you must stay <3.10, replace with if/elif or a dict dispatch.
Bottom line: match/case is fine in Pro only if you’re truly on Python 3.10+; otherwise it will break parsing/execution and nothing after will run. – Venkat