Here is the code I use:
from P4 import P4, P4Exception
mp = P4.Map()
And here's the error I get:
mp = P4.Map() AttributeError: type object 'P4' has no attribute 'Map'
WHY? According to P4Python manuals such class method should construct a new Map object.
Because you import class P4
from P4.py
. Map is another class from P4.py. See source code: https://github.com/rptb1/p4python/blob/master/P4.py
You should try this:
import P4
mp = P4.Map()