How to read model code from a .stan file?

Hi all. I’m new to stan and have a very basic question. Currently I’m building models like this:

import stan

model_code = """
// model here
"""
model = stan.build(model_code, data=data, random_seed=64)

How can I read the model_code from a .stan file instead? Something like this:

model = stan.build(model_file_path, data=data, random_seed=64)
  • Ubuntu
  • 3.11.9
  • 3.10.0
  • gcc

Hi, read it like a normal text file

with open("path/to/model.stan", "r") as f:
    model_code = f.read()