Use imports_passed_through when importing activities into workflow code:
with workflow.unsafe.imports_passed_through(): import test_activity
See https://docs.temporal.io/develop/python/python-sdk-sandbox#passthrough-modules for more info.