Within a Julia script, can you tell whether the script has been imported or executed directly?

A common convention in python is to structure the main functionality of a script as follows, so it can be both run as a script directly or imported without executing main() at the time of import: ...