Map variable placement..always required at the end of cell?

05-24-2019 04:58 PM
New Contributor II

Trying to use the ArcGIS API for Python in Juypter Notebooks. It seems the map variable is required to be at the bottom of the cell. For example, this doesn't work for me

if I remove the if statement and put map2 at the bottom (as in most examples) it works.

is there anyway around that?

0 Kudos
2 Replies
Esri Contributor

Hi, Brad Cooper

This is default behavior in Jupyter, if there is an object at the end of a cell it is evaluated and sent to the output area, put it anywhere else and it's ignored.

There are several ways around this.

In your case the easiest solution is probably a simple restructure of the code:

Or you can wrap your code in a function:

0 Kudos
New Contributor II

Thanks, I ended up doing a little different and forgot to post. Our solution was to use display