In Scala the call is
dbutils.notebook.getContext.notebookPath.get
In Python the call is
dbutils.entry_point.getDbutils().notebook().getContext().notebookPath().getOrElse(None)
If you need it in another language, a common practice would be to pass it through spark config.
Ignoring that we can get the value in Python (as seen above), if you start with a Scala cell like this:
%scala
val path = dbutils.notebook.getContext.notebookPath.get
spark.conf.set("com.whaterver.notebook-path")
And then in the next Python cell (the same concepts applies to R and SQL)
%python
path = spark.conf.get("com.whaterver.notebook-path")
You just want to adjust the configuration parameter's name to be a unique value so as not to accidentally clash with something. For example, we often use "com.databricks.training"