I have a rather basic python question re: modules
I have a python script that's essentially structured as follows:
======================================
## aaa.py
func1():
...some code...
...arcpy.AddMessage("message")
...return
func2():
...some code...
...arcpy.AddMessage("message")
...return
If __name__ = "main":
...import sys, arcpy, argparse, os, time
...some code...
...func1()
...func2()
...return
======================================
I want to write another script that uses the functions within aaa.py. So I import aaa.py as a module into this other script (see bleow).
======================================
## bbb.py
import sys, arcpy, argparse, os, time, aaa
some code...
aaa.func1()
=======================================
When I execute aaa all is fine.
When I execute bbb, it returns an error "NameError: global name 'arcpy' is not defined".
Appreciate any insight on how to avoid this.
b
PS - used ... in post above to show indent since spaces and tabs removed
I have a python script that's essentially structured as follows:
======================================
## aaa.py
func1():
...some code...
...arcpy.AddMessage("message")
...return
func2():
...some code...
...arcpy.AddMessage("message")
...return
If __name__ = "main":
...import sys, arcpy, argparse, os, time
...some code...
...func1()
...func2()
...return
======================================
I want to write another script that uses the functions within aaa.py. So I import aaa.py as a module into this other script (see bleow).
======================================
## bbb.py
import sys, arcpy, argparse, os, time, aaa
some code...
aaa.func1()
=======================================
When I execute aaa all is fine.
When I execute bbb, it returns an error "NameError: global name 'arcpy' is not defined".
Appreciate any insight on how to avoid this.
b
PS - used ... in post above to show indent since spaces and tabs removed